Skip to content

Fix scale parameter for polygons with datashader#555

Merged
timtreis merged 2 commits intomainfrom
fix/issue-473-scale-polygons-datashader
Mar 23, 2026
Merged

Fix scale parameter for polygons with datashader#555
timtreis merged 2 commits intomainfrom
fix/issue-473-scale-polygons-datashader

Conversation

@timtreis
Copy link
Member

@timtreis timtreis commented Mar 23, 2026

Summary

  • Fixes scale parameter for shapes has no impact on polygons with datashader #473: the scale parameter in render_shapes() had no effect on Polygon/MultiPolygon geometries when using the datashader backend
  • Adds scaling via shapely.affinity.scale() around each geometry's centroid in the datashader path, matching existing matplotlib behavior
  • Adds regression test test_plot_can_scale_polygons_datashader

timtreis and others added 2 commits March 23, 2026 23:30
The datashader rendering path only applied the `scale` parameter to
circle geometries (Points with radius). Polygon and MultiPolygon
geometries were passed through unscaled. This adds scaling via
`shapely.affinity.scale()` around each geometry's centroid, matching
the existing matplotlib path behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.87%. Comparing base (61ed9c3) to head (b199ad0).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #555      +/-   ##
==========================================
+ Coverage   73.66%   73.87%   +0.20%     
==========================================
  Files          10       10              
  Lines        2738     2752      +14     
  Branches      637      639       +2     
==========================================
+ Hits         2017     2033      +16     
+ Misses        447      446       -1     
+ Partials      274      273       -1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 82.12% <100.00%> (+0.24%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 23010b9 into main Mar 23, 2026
8 checks passed
@timtreis timtreis deleted the fix/issue-473-scale-polygons-datashader branch March 23, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scale parameter for shapes has no impact on polygons with datashader

2 participants