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) <