Python Plotly:如何填充线之间的区域?

Python Plotly:如何填充线之间的区域?,python,plotly,Python,Plotly,我在用绘图仪构建地平线图时遇到了困难。我使用中的演示代码成功地使用matplotlib.plotly构建了这个函数,但是使用plotly失败,因为我在plotly中找不到任何函数来实现fill\u 我想知道如何在中绘图地填充两条虚线之间的区域 只需像这样使用fill=tozeroy: 绘图: import plotly.graph_objects as go fig = go.Figure() fig.add_trace(go.Scatter(x=[1, 2, 3], y=[0, 2, 3],

我在用
绘图仪构建地平线图时遇到了困难。我使用中的演示代码成功地使用
matplotlib.plotly
构建了这个函数,但是使用
plotly
失败,因为我在
plotly
中找不到任何函数来实现
fill\u


我想知道如何在
中绘图地填充两条虚线之间的区域

只需像这样使用
fill=tozeroy

绘图:

import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[0, 2, 3],
                         mode = 'lines',
                         fill='tozeroy'))
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[3, 5, 4],
                         mode = 'lines',
                         fill='tonexty'))
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5.5, 6],
                         mode = 'lines',
                         fill='tonexty'))

fig.show()

代码:

import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[0, 2, 3],
                         mode = 'lines',
                         fill='tozeroy'))
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[3, 5, 4],
                         mode = 'lines',
                         fill='tonexty'))
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5.5, 6],
                         mode = 'lines',
                         fill='tonexty'))

fig.show()