plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

[Fix] Always respect user-specified `color_continuous_scale`

Open antonymilne opened this issue 1 month ago • 0 comments

Fixes https://github.com/plotly/plotly.py/issues/5433. When a user explicitly provides color_continuous_scale, it should always be respected, even if the template has coloraxis_autocolorscale=True. Previously, the template's autocolorscale 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-specified color_continuous_scale would have been ignored.

autocolorscale=True autocolorscale=False
01_autocolorscale_True_colorscale_red_yellow_green 02_autocolorscale_False_colorscale_red_yellow_green
03_autocolorscale_True_no_colorscale_sequential 04_autocolorscale_False_no_colorscale_sequential
07_autocolorscale_True_no_colorscale_diverging 08_autocolorscale_False_no_colorscale_diverging

Code PR

  • [x] I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the code generator and not the generated files.
  • [x] I have added tests or modified existing tests.
  • [ ] For a new feature, I have added documentation examples (please see the doc checklist as well).
  • [x] 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.

antonymilne avatar Dec 02 '25 10:12 antonymilne