[问题] plotly 多层绘图问题

楼主: DRLai (苏打)   2018-10-30 18:28:13
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) <
楼主: DRLai (苏打)   2018-10-30 18:44:00
第一题自问自答 ... 改用 overlay
作者: jumptoswim (610)   2018-10-31 11:42:00
subfig should worksorry, i mean subplot

Links booklink

Contact Us: admin [ a t ] ucptt.com