plotlyのsubplotを利用してプロットしたグラフで2軸の複合グラフを作成したいのですが、上手くいきません。
下記trace~trace5までのグラフデータを3行1列でプロットしたいです。
fig['data'][1].update(yaxis='y2')
fig['layout']['yaxis2'].update(dict(overlaying='y',anchor='x',side='right'))のデータではうまくy軸、第二y軸でプロットできているようなのですが、それ以降がうまくいきません。
解決策をご教示頂けると助かります。宜しくお願い致します。
fig = tools.make_subplots(rows=3,cols=1) trace = go.Scatter(x=df.index,y=df.A, mode='lines') trace1 = go.Scatter(x=df1.index,y=df.B, mode='lines') trace2 = go.Scatter(x=df2.index,y=df.C, mode='lines') trace3 = go.Scatter((x=df3.index,y=df.D, mode='lines') trace4 = go.Scatter(x=df4.index,y=df.E, mode='lines') trace5 = go.Scatter((x=df5.index,y=df.F, mode='lines') fig.append_trace(trace ,1,1) fig.append_trace(trace1 ,1,1) fig.append_trace(trace2 ,2,1) fig.append_trace(trace3 ,2,1) fig.append_trace(trace4 ,3,1) fig.append_trace(trace5 ,3,1) fig['layout'].update(height=1800, width=1200, showlegend=False) fig['data'][1].update(yaxis='y2') fig['layout']['yaxis2'].update(dict(overlaying='y',anchor='x',side='right')) fig['data'][3].update(yaxis='y3') fig['layout']['yaxis3'].update(dict(overlaying='y2',anchor='x2',side='right')) fig['data'][5].update(yaxis='y3') fig['layout']['yaxis3'].update(dict(overlaying='y3',anchor='x3',side='right')) plotly.offline.plot(fig)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。