Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
EliasRas opened this issue May 2, 2023 · 2 comments
Closed

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

EliasRas opened this issue May 2, 2023 · 2 comments

Comments

@EliasRas
Copy link

EliasRas commented May 2, 2023

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

@EliasRas
Copy link
Author

EliasRas commented Jun 1, 2023

Should I post this issue to plotly.js repo?

@EliasRas
Copy link
Author

Duplicate of plotly/plotly.js#3402. Using offsetgroup fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant