Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Fix] Always respect user-specifiedcolor_continuous_scale#5439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
antonymilne wants to merge3 commits intoplotly:main
base:main
Choose a base branch
Loading
fromantonymilne:autocolorscale

Conversation

@antonymilne
Copy link
Contributor

@antonymilneantonymilne commentedDec 2, 2025
edited
Loading

Fixes#5433. When a user explicitly providescolor_continuous_scale, it should always be respected, even if the template hascoloraxis_autocolorscale=True. Previously, the template'sautocolorscale setting would override the user's explicit colorscale.

A couple of tests are failing but I'm pretty sure it's not my fault.

Here's the behaviour now. Before this PR, all plots in the above table would have looked the same with the exception of the top left one, where the user-specifiedcolor_continuous_scale would have been ignored.

autocolorscale=Trueautocolorscale=False
01_autocolorscale_True_colorscale_red_yellow_green02_autocolorscale_False_colorscale_red_yellow_green
03_autocolorscale_True_no_colorscale_sequential04_autocolorscale_False_no_colorscale_sequential
07_autocolorscale_True_no_colorscale_diverging08_autocolorscale_False_no_colorscale_diverging

Code PR

  • I have read through thecontributing notes and understand the structure of the package. In particular, if my PR modifies code ofplotly.graph_objects, my modifications concern the code generator andnot the generated files.
  • I have added tests or modified existing tests.
  • For a new feature, I have added documentation examples (please see the doc checklist as well).
  • I have added a CHANGELOG entry if changing anything substantial.
  • For a new feature or a change in behavior, I have updated the relevant docstrings in the code.

petar-qb and huong-li-nguyen reacted with thumbs up emoji
…autocolorscale=TrueWhen a user explicitly provides color_continuous_scale, it should always berespected, even if the template has coloraxis_autocolorscale=True. Previously,the template's autocolorscale setting would override the user's explicitcolorscale.The fix tracks whether color_continuous_scale was explicitly provided by theuser (before apply_default_cascade fills it from template/defaults), and onlysets autocolorscale=False when the user explicitly provided a colorscale. Thispreserves automatic diverging palette selection when colorscale comes fromtemplate/defaults.Changes:- plotly/express/_core.py: Track user_provided_colorscale and conditionally  set autocolorscale=False only when user explicitly provides colorscale- plotly/express/_imshow.py: Same fix for imshow() function
Add tests to verify that user-provided color_continuous_scale overridestemplate autocolorscale=True, and that template autocolorscale is respectedwhen user doesn't provide a colorscale.Changes:- tests/test_optional/test_px/test_colors.py: Add test_color_continuous_scale_autocolorscale()- tests/test_optional/test_px/test_imshow.py: Add test_imshow_color_continuous_scale_autocolorscale()
@antonymilneantonymilne marked this pull request as ready for reviewDecember 2, 2025 11:51
@antonymilneantonymilne changed the titleFix: Respect user-specified color_continuous_scale when template has …[Fix] Always respect user-specifiedcolor_continuous_scaleDec 2, 2025
Add changelog entry for PRplotly#5439 fixing issue where user-specifiedcolor_continuous_scale was ignored when template had autocolorscale=True.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@emilyklemilyklAwaiting requested review from emilykl

At least 1 approving review is required to merge this pull request.

Assignees

@emilyklemilykl

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug] Plotly expresscolor_continuous_scale ignored when template hasautocolorscale=True

2 participants

@antonymilne@emilykl

[8]ページ先頭

©2009-2025 Movatter.jp