其他分享
首页 > 其他分享> > plotly可视化绘制多子图(subplots)并自定义坐标轴

plotly可视化绘制多子图(subplots)并自定义坐标轴

作者:互联网

plotly可视化绘制多子图(subplots)并自定义坐标轴

# 多子图并自定义坐标轴

from plotly import tools
import plotly as py
import plotly.graph_objs as go


pyplt = py.offline.plot

trace1 = go.Scatter(x=[1, 2, 3], y=[4, 5, 6])
trace2 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70])
trace3 = go.Scatter(x=[300, 400, 500], y=[600, 700, 800])
trace4 = go.Scatter(x=[4000, 5000, 6000], y=[7000, 8000, 9000])

fig = tools.make_subplots(rows=2, cols=2, subplot_titles=('Plot 1', 'Plot 2',
                                                          'Plot 3', 'Plot 4'))
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 2)
fig.append_trace(trace3, 2, 1)
fig.append_trace(trace4, 2, 2)

fig['layout']['xaxis1'].update(title='xaxis 1 title')
fig['layout']['xaxis2'].update(title='xaxis 2 title', range=[10, 50])
fig[

标签:Plot,自定义,title,subplots,fig,plotly,go,append
来源: https://blog.csdn.net/zhongkeyuanchongqing/article/details/119281666