Repository navigation
Conversation
KoolADE85
self-requested a review
November 2, 2026 21:07
This branch has not been deployed
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.
Link to issue
Closes #5189
Description of change
This PR fixes inconsistent colorscale behavior when using
updatemenusbuttons.Previously, some named colorscales were not correctly applied when selected through a button. Others, such as
JetandYlGnBu, could produce different colors compared to the same colorscale defined directly in a trace.The fix automatically converts named colorscales into their explicit Plotly.py color definitions before passing them to Plotly.js.
The change was implemented in the code generator (
codegen/datatypes.py) so that it is preserved when theButtonclass is regenerated.Demo
The screenshots below compare the behavior before and after the fix.
Before:
After:
After the fix, selecting
Jetthrough the dropdown produces the same colors as definingJetdirectly in the heatmap.Testing strategy
Manually tested the change using two heatmaps with identical data: one with a fixed colorscale and another with a colorscale controlled by
updatemenusbuttons.Verified that selecting
Jetproduces consistent colors and that the previously reversedYlGnBucolorscale is displayed correctly.No automated regression tests have been added yet.
Additional information (optional)
The issue appears to originate from differences between the named colorscale definitions used by Plotly.py and Plotly.js.
The fix normalizes these names on the Python side without requiring changes to Plotly.js.
I used ChatGPT to help me understand the Plotly.py codebase, navigate its architecture, and identify the relevant files and mechanisms involved in this issue.
The proposed fix was tested manually to verify that it resolves the colorscale inconsistencies.
Guidelines