Skip to content

Fix colorscale inconsistencies in updatemenu buttons - #5863

Open
Arznik7 wants to merge 1 commit into
plotly:mainfrom
Arznik7:fix-updatemenu-colorscale
Open

Arznik7 wants to merge 1 commit into
plotly:mainfrom
Arznik7:fix-updatemenu-colorscale

Conversation

@Arznik7

@Arznik7 Arznik7 commented Nov 1, 2026

Copy link
Copy Markdown

Link to issue

Closes #5189

Description of change

This PR fixes inconsistent colorscale behavior when using updatemenus buttons.

Previously, some named colorscales were not correctly applied when selected through a button. Others, such as Jet and YlGnBu, 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 the Button class is regenerated.

Demo

The screenshots below compare the behavior before and after the fix.

Before:

Before fix

After:

Capture d'écran 2026-11-01 191812

After the fix, selecting Jet through the dropdown produces the same colors as defining Jet directly 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 updatemenus buttons.

Verified that selecting Jet produces consistent colors and that the previously reversed YlGnBu colorscale 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

@KoolADE85 KoolADE85 self-assigned this Nov 2, 2026
@KoolADE85
KoolADE85 self-requested a review November 2, 2026 21:07

This branch has not been deployed

No deployments
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.

Missing colorscales in ui buttons

2 participants