python 3.7 版
各位版友好
最近想要將多張圖表透過 plotly 呈現
程式大概如下:
from plotly import tools
import plotly.graph_objs as go
trace1 = go.Bar(...)
trace2_1 = go.Scatter(...)
trace2_2 = go.Scatter(...)
trace2_3 = go.Scatter(...)
trace2 = [trace2_1, trace2_2, trace2_3]
單獨繪製 trace1 or trace2 都是正常的
但我想要將所有資料呈現在同個畫面
(trace1, trace2 的x軸共用)
fig = tools.make_subplots(rows=2, cols=1, specs=[[{}],[{}]],
shared_xaxes=True, shared_yaxes=True,
vertical_spacing=0.001)
fig.append_trace(trace1 , 1, 1)
fig.append_trace(trace2 , 2, 1) <