Skip to content

Commit 762f17b

Browse files
committed
also set offsetgroup if no barmode is set
1 parent 390dfc5 commit 762f17b

File tree

1 file changed

+4
-3
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,10 +2558,11 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
25582558
legendgroup=trace_name,
25592559
showlegend=(trace_name != "" and trace_name not in trace_names),
25602560
)
2561-
# Set 'offsetgroup' only in group barmode
2561+
# Set 'offsetgroup' only in group barmode (or if no barmode is set)
2562+
barmode = args.get("barmode")
25622563
if (
2563-
trace_spec.constructor in [go.Bar, go.Histogram]
2564-
and args.get("barmode") == "group"
2564+
trace_spec.constructor in [go.Bar, go.Box, go.Violin, go.Histogram]
2565+
and barmode == "group" or barmode is None
25652566
):
25662567
trace.update(alignmentgroup=True, offsetgroup=trace_name)
25672568
trace_names.add(trace_name)

0 commit comments

Comments
 (0)