Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ruff
  • Loading branch information
antonymilne committed Dec 4, 2025
commit a3853d2afc113cea2fda3ab98b435e745823abfd
6 changes: 3 additions & 3 deletions plotly/express/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,9 @@ def apply_default_cascade(args, constructor):
if hasattr(trace_data, "marker")
and hasattr(trace_data.marker, "color")
]
# If template contains at least one color for this trace type, assign to color_discrete_sequence
if any(trace_specific_colors):
args["color_discrete_sequence"] = trace_specific_colors
# If template contains at least one color for this trace type, assign to color_discrete_sequence
if any(trace_specific_colors):
args["color_discrete_sequence"] = trace_specific_colors
# fallback to layout.colorway if trace-specific colors not available
if args["color_discrete_sequence"] is None and args["template"].layout.colorway:
args["color_discrete_sequence"] = args["template"].layout.colorway
Expand Down
3 changes: 1 addition & 2 deletions tests/test_optional/test_px/test_px.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from itertools import permutations
import warnings

import pandas as pd
import plotly.express as px
import plotly.io as pio
import narwhals.stable.v1 as nw
Expand Down Expand Up @@ -227,8 +228,6 @@ def test_px_templates(backend):


def test_px_templates_trace_specific_colors(backend):
import pandas as pd

tips = px.data.tips(return_type=backend)

# trace-specific colors: each trace type uses its own template colors
Expand Down