Skip to content

Box plot x-offsets not working correctly with multiple subplots #4186

@EliasRas

Description

@EliasRas

Description

When plotting multiple box plot traces with boxmode="group" in a figure with multiple subplots, the traces are offset based on all subplots. This happens even if shared_xaxes=False and shared_yaxes=False.

Expected behaviour
The boxes are offset only if multiple traces are plotted in the same subplot. I'd expect the top left subplot to always look like in the last part of the image below.
ExampleImg

To reproduce

import plotly.graph_objects as go
from plotly.subplots import make_subplots

x = [0,0]
y1 = [1,2]
y2 = [1,2]

figure = make_subplots(rows=2,cols=2)
figure.add_trace(go.Box(x=x,y=y1),row=1,col=1)
figure.add_trace(go.Box(x=x,y=y1),row=2,col=1)
figure.add_trace(go.Box(x=x,y=y2),row=1,col=2)
figure.add_trace(go.Box(x=x,y=y2),row=1,col=1)
figure.update_layout(boxmode="group")
figure.show()

Additional Context

Plotly 5.14.1
Python 3.11.1
Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions