Fix datashader fill_alpha applied twice#552
Merged
Conversation
Alpha was passed both to ds.tf.shade(min_alpha=...) and to ax.imshow(alpha=...), resulting in effective transparency of fill_alpha² instead of fill_alpha. Remove the second application since the RGBA channels from datashader already encode transparency. Affects shapes (fill_alpha), points (alpha), and shape outlines (outline_alpha). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Regenerated from CI after fixing the double-alpha bug (#367). Only 2 tests exceeded the RMS tolerance; the rest were within bounds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
03426f8 to
b856ae0
Compare
- Add regression test for outline_alpha double-application - Make points test docstring consistent with shapes test - Replace :issue:`367` with plain #367 (no Sphinx role configured) - Remove redundant inline comment in shapes test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exercises both code paths (_render_ds_image and _render_ds_outlines) in a single render call, halving the test cost. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #552 +/- ##
=======================================
Coverage 73.66% 73.66%
=======================================
Files 10 10
Lines 2738 2738
Branches 637 637
=======================================
Hits 2017 2017
Misses 447 447
Partials 274 274
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fill_alpha(andalphafor points,outline_alphafor outlines) was applied twice — once inds.tf.shade(min_alpha=...)baking it into the RGBA image, then again inax.imshow(alpha=...)multiplying the alpha channel a second timefill_alpha²instead offill_alpha(e.g., 0.25 instead of 0.5), making datashader elements appear lighter than their matplotlib equivalents_render_ds_image()and_render_ds_outlines(), since the RGBA channels from datashader already encode transparency correctly