Black Lives Matter. Please consider donating to Black Girls Code today.

Subplot Y axis not aligned

Hi everyone, I have a problem with a chart with a subplot, practically the zero of the y axis of the two graphs are not at the same height.
Code:

fig = make_subplots(specs=[[{"secondary_y": True}]])

fig.add_trace(
    go.Bar(x=df['data'], y=df['daily_deaths'],
           name='Daily deaths',
           marker_color='orange'),
    secondary_y=True
)

fig.add_trace(
    go.Scatter(x=df['data'],
               y=df['nuovi_positivi'],
               name='New daily cases',
               line=dict(color='blue'))
)
fig.update_yaxes(rangemode='tozero' # tried this, but it did not work.
                )

here a picture:

How can I fix this?

Thanks

Hi @dinerbuxur,

Insert secondary_y=False' withinfig.add_trace(go.Scatter(), secondary_y=False)andrangemode=‘tozero’` will work.

Hi, thank you for your reply.
I fixed adding rangemode='nonnegative', the issue was probably caused by some anomaly in the data (negative values).