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

标签 python plotly

我在构建地平线图时遇到困难 plotly .我成功地用 matplotlib.plotly 构建了这个使用来自 Implementing horizon charts in matplotlib 的演示代码,但失败 plotly因为我找不到任何函数来实现fill_betweenplotly .

我想知道如何填充 plotly 中两条虚线之间的区域.

最佳答案

只需使用 fill=tozeroy像这样:

剧情:

enter image description here

代码:

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

关于python - Plotly:如何填充线之间的区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53459502/

相关文章:

r - 如何在稀疏点之间插入数据以在 R 和plotly 中绘制等高线图

python - 如何在plotly中绘制隐式方程?

anaconda - 在 jupyterlab 中使用 plot.ly - 图形不显示

python - 每个方面的 Y 轴自动缩放

python - 在 Plotly Python 中移动 x Axis 和 y Axis 刻度

python - 是否可以打印变量的实际名称,而不是它包含的值?

python - ruby /Mechanize : Not getting all the cookies after logging into a page

python - 脚本在负值 scipy.optimize 时中断

当缺少用户用户输入时,Python 索引超出范围

python - 'Marshmallow' 对象没有属性 'ModelSchema'