Using plotly in python, I want to plot bar charts with multiple y-axes, as the values of the one is significantly larger than the other.

I have tried to solve this using plotly.subplots.make_subplots, but I can not get them to plot next to each other similar to the normal plotly barmode='group' functionality.
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(specs=[[{'secondary_y': True}]])
fig.add_bar(name='group 1',x=x1, y=y1, secondary_y=False)
fig.add_bar(name='group 2', x=x2, y=y2, secondary_y=True)
fig.update_layout(
xaxis_title='x-axis',
yaxis_title='y-axis')
The bars plot behind each other, I have tinkered with the parameters of make_suplots to no avail.
How can I get the desired results?
Edit:
I tried Jaroslav's answer and it kind of works. Feels like a sub-optimal implementation and keys cut of values on the second y axis.
Definitely good to know of and should work in most cases though so thanks!


