Skip to content

Fix outline linewidth mismatch between matplotlib and datashader#543

Merged
timtreis merged 2 commits intomainfrom
fix/datashader-outline-width-units
Mar 5, 2026
Merged

Fix outline linewidth mismatch between matplotlib and datashader#543
timtreis merged 2 commits intomainfrom
fix/datashader-outline-width-units

Conversation

@timtreis
Copy link
Member

@timtreis timtreis commented Mar 5, 2026

Summary

  • Fixes Different outline linewidths between matplotlib and datashader #493: datashader outlines were thinner than matplotlib outlines for the same outline_width value
  • Matplotlib interprets linewidth in points (1pt = 1/72 inch), while datashader's Canvas.line() uses canvas pixels
  • Applied a dpi / 72 scaling factor to convert points → pixels before passing to datashader, matching the existing DPI-scaling pattern used for point sizes (render.py:805)

Test plan

  • Added test_datashader_outline_width_uses_points_units covering single and tuple outline widths
  • Existing datashader outline tests still pass
  • Pre-existing image comparison failures are unrelated (also fail on main)

🤖 Generated with Claude Code

timtreis and others added 2 commits March 5, 2026 21:21
Datashader's Canvas.line() interprets line_width in canvas pixels, while
matplotlib uses points (1pt = 1/72 inch). Applying a dpi/72 scaling factor
brings the datashader outline width in line with the matplotlib result.

Fixes #493

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.00%. Comparing base (264bc92) to head (d666ae9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #543   +/-   ##
=======================================
  Coverage   84.00%   84.00%           
=======================================
  Files           9        9           
  Lines        2600     2601    +1     
=======================================
+ Hits         2184     2185    +1     
  Misses        416      416           
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 88.92% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 6be1b41 into main Mar 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different outline linewidths between matplotlib and datashader

2 participants