I need some help with make_subplots function.
I’m trying to make subplots with two y axes each, as show for matplotlib:
However, I can’t do it using make_subplot()
fig = make_subplots(rows=choke_steps.shape[0]//3, cols=3,
specs=[[{"secondary_y": "True"}]*3]*8)
for i in range(0,choke_steps.shape[0]):
instante = dt.datetime.strptime(choke_steps[i], "%Y-%m-%d %H:%M:%S")
ini = (instante - dt.timedelta(minutes = 10)).strftime("%Y-%m-%d %H:%M:%S")
fim = (instante + dt.timedelta(minutes = 60)).strftime("%Y-%m-%d %H:%M:%S")
df_aux = df.loc[ini:fim]
col = 1 if i < 8 else (3 if i > 15 else 2)
row = 1 if (i == 0 or i == 8 or i ==16) else row+1
fig.add_trace(go.Scatter(x=df_aux.index,y=df_aux.PDG,name='PDG',showlegend=False),
row=row, col=col)
fig.add_trace(go.Scatter(x=df_aux.index,y=df_aux.CHOKE,name='CHOKE',showlegend=False,yaxis='y2'),
row=row, col=col)
fig.update_layout()
fig.update_layout(title_text="RO92 - Visualização steps",
height=150*df.shape[1]//2,
yaxis2 = dict(title='Choke [%]', overlaying='y', side='right'),)