[Fix] Always respect user-specified `color_continuous_scale` by antonymilne · Pull Request #5439 · plotly/plotly.py
added 2 commits
December 2, 2025 10:37…autocolorscale=True 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. The fix tracks whether color_continuous_scale was explicitly provided by the user (before apply_default_cascade fills it from template/defaults), and only sets autocolorscale=False when the user explicitly provided a colorscale. This preserves automatic diverging palette selection when colorscale comes from template/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 overrides template autocolorscale=True, and that template autocolorscale is respected when 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()
antonymilne
changed the title
Fix: Respect user-specified color_continuous_scale when template has …
[Fix] Always respect user-specified color_continuous_scale
Add changelog entry for PR plotly#5439 fixing issue where user-specified color_continuous_scale was ignored when template had autocolorscale=True.
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