Repository navigation
fix(heatmap): resolve color_scale to the plotly.js built-in names so the default draws viridis - #111
Merged
Merged
Conversation
…the default draws viridis
This was referenced Sep 29, 2026
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.
Closes #100.
Change
color_scalehas one vocabulary: the 18 built-in color scales of plotly.js 4.1.1 (checked againstsrc/components/colorscale/scales.js). The list lives inflexviz/trace/_hist_helpers.py.normalize_heatmap_color_scalematches a name without regard to case and returns the Plotly spelling. An unknown name raisesValueErrorwith the list of valid names, when the trace is built."Viridis"(Histogram2D,GeoHistogram2D, absoluteCorrHeatmap) and"RdBu"(signedCorrHeatmap)."viridis"renders viridis.plasma,magmaandinfernoare removed from the docs and from the ECharts color arrays. plotly.js has no such scales.Architecture.mdand the threecolor_scaledocstrings describe the vocabulary.Impact
add_histogram2d,add_geo_histogram2dand absoluteadd_corr_heatmapdrewReds. It now draws viridis.color_scale="plasma"(ormagma,inferno, or any other unknown name) raisesValueError. Before, Plotly drew its automatic scale for it./view, as an invalidcolor_rangedoes today. Decoded specs skip trace validation: invalid display values give HTTP 500 at /view, and /share accepts them #99 turns this into a 400.Tests
test_hist2d_default_color_scale_renders_viridisreads_fullData[0].colorscale. It fails onmain(rgb(220,220,220), Reds) and passes here.pytest tests flexviz_polars/tests: 2394 passed, 2 skipped.pytest -m browser tests: 317 passed, 12 skipped.