Skip to content

Commit b127443

Browse files
committed
set offsetgroup only in group barmode
1 parent 05c7257 commit b127443

File tree

1 file changed

+6
-0
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,6 +2194,12 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
21942194
legendgroup=trace_name,
21952195
showlegend=(trace_name != "" and trace_name not in trace_names),
21962196
)
2197+
# Set 'offsetgroup' only in group barmode
2198+
if (
2199+
trace_spec.constructor in [go.Bar, go.Violin, go.Box, go.Histogram]
2200+
and args["barmode"] == "group"
2201+
):
2202+
trace.update(alignmentgroup=True, offsetgroup=trace_name)
21972203
trace_names.add(trace_name)
21982204

21992205
# Init subplot row/col

0 commit comments

Comments
 (0)