Hello,
I want to build a bar chart in which 2 dataseries belong to the first axis, and 2-3 dataseries to the second.
barmode=‘group’ must be applied to all data but it only works for data on different axes. Is it possible to apply barmode=‘group’ to all the data?
Alternatively, I can draw invisible axes, but it’s tedious
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Bar(
x=[10, 20, 30],
y=[200, 450, 700],
name="yaxis1 values",
yaxis="y",
offsetgroup=1,
))
fig.add_trace(go.Bar(
x=[10, 20, 30],
y=[900, 350, 560],
name="yaxis3 values",
yaxis="y",
offsetgroup=1,
))
fig.add_trace(go.Bar(
x=[10, 20, 30],
y=[2000, 5000, 7000],
name="yaxis4 values",
yaxis="y2",
offsetgroup=2,
))
fig.update_layout(
xaxis=dict(
domain=[0, 0.7]
),
yaxis=dict(
title="yaxis 1",
),
yaxis2=dict(
title="yaxis 2",
anchor="x",
overlaying="y",
side="right"
),
barmode='group',
)