Skip to content

Commit db1e0d9

Browse files
committed
move set barmode outside trace loop
1 parent ab08bd4 commit db1e0d9

File tree

1 file changed

+7
-7
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+7
-7
lines changed

packages/python/plotly/plotly/express/_core.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -2478,6 +2478,13 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
24782478
constructor = go.Bar
24792479
args = process_dataframe_timeline(args)
24802480

2481+
# With marginal histogram, if barmode is not set, set to "overlay"
2482+
if (
2483+
"histogram" in [args.get("marginal_x"), args.get("marginal_y")]
2484+
and "barmode" not in args
2485+
):
2486+
layout_patch["barmode"] = "overlay"
2487+
24812488
trace_specs, grouped_mappings, sizeref, show_colorbar = infer_config(
24822489
args, constructor, trace_patch, layout_patch
24832490
)
@@ -2550,13 +2557,6 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
25502557
showlegend=(trace_name != "" and trace_name not in trace_names),
25512558
)
25522559

2553-
# With marginal histogram, if barmode is not set, set to "overlay"
2554-
if (
2555-
"histogram" in [args.get("marginal_x"), args.get("marginal_y")]
2556-
and "barmode" not in args
2557-
):
2558-
layout_patch["barmode"] = "overlay"
2559-
25602560
# Set 'offsetgroup' only in group barmode (or if no barmode is set)
25612561
barmode = args.get("barmode") or layout_patch.get("barmode")
25622562
if trace_spec.constructor in [go.Bar, go.Box, go.Violin, go.Histogram] and (

0 commit comments

Comments
 (0)