Hello,
I’m having issue with relative barmode and width.
For instance this code is fine:
fig = go.Figure(layout=go.Layout(
title='SomeTest',
yaxis2=dict(title='Test', domain=[0.25, 0.95]),
yaxis=dict(title='Test', domain=[0, 0.2]),
xaxis=dict(title='Time'),
legend=dict(x=0, y=1),
barmode="relative"
))
fig.add_trace(go.Bar(
x=["2020-12-31", "2021-01-31"],
y=[3,7],
name="SOmeName",
yaxis="y2",
))
fig.show()
It gives me:
But as soon as I want to change the width of the bars, and therefore write:
fig = go.Figure(layout=go.Layout(
title='SomeTest',
yaxis2=dict(title='Test', domain=[0.25, 0.95]),
yaxis=dict(title='Test', domain=[0, 0.2]),
xaxis=dict(title='Time'),
legend=dict(x=0, y=1),
barmode="relative"
))
fig.add_trace(go.Bar(
x=["2020-12-31", "2021-01-31"],
y=[3,7],
name="SOmeName",
yaxis="y2", # y or y2 does not change anything
width=0.6
))
fig.show()
Then I get this:
If I copy paste an example from the doc, and modify it a bit, as below:
x = [1, 2, 3, 4]
fig3 = go.Figure()
fig3.add_trace(go.Bar(x=x, y=[1, 4, 9, 16]))
fig3.add_trace(go.Bar(x=x, y=[6, -8, -4.5, 8], width=0.4))
fig3.add_trace(go.Bar(x=x, y=[-15, -3, 4.5, -8]))
fig3.add_trace(go.Bar(x=x, y=[-1, 3, -3, -4], width=0.3))
fig3.update_layout(barmode='relative', title_text='Relative Barmode')
fig3.show()
Then I get this:
So, it should work. Why does my first example fails to render the bars ?