Repository navigation
fix: apply alpha to gradient palette colors in data_color() - #892
Merged
Merged
Conversation
GradientPalette interpolates using RGB tuples internally, which have no alpha channel, so the alpha= value baked into the palette was lost by the time colors were assigned to cells. Reapply alpha to the interpolated colors after the gradient scale runs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #892 +/- ##
=======================================
Coverage 98.33% 98.34%
=======================================
Files 52 52
Lines 8310 8316 +6
=======================================
+ Hits 8172 8178 +6
Misses 138 138 ☔ View full report in Codecov by Harness. 🚀 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
GT.data_color(alpha=...)had no effect on cells colored by a gradient palette (the default numeric/factor path).GradientPaletteinterpolates colors usingRGBColortuples (tuple[int, int, int]) internally, which have no alpha channel, so thealpha=value baked intopalettebefore interpolation was lost by the time each color was assigned to a cell.na_colorwas unaffected since it goes through_html_color(alpha=...)separately.This reapplies
alpha=to the interpolated colors right aftercolor_scale_fnruns, skippingNoneentries (which stand in for NA values and getna_colorafterward).Related GitHub Issues and PRs
data_color()#711Checklist