我正在尝试绘制类似于link图表的图表link

我想要的是遮蔽平均线周围的区域(虚线) . 所以我计算了一个标准偏差并绘制了两条分开的线(上方和下方) .

当我尝试使用链接示例中的相同代码时,它会在我的图表中绘制一个大矩形:经过一些测试,我注意到如果我删除 fill='tozerox', fillcolor='rgb(0,176,246)' 参数,它只是在图表的末尾绘制一条大的垂直线:

现在这是我的代码 . 请注意,因为我可以单独绘制线条(注释行= chart1),我认为这是一个公平的假设,这不是数据问题

def plot_chart(ratio, mean, time, up_close, low_close):
    time_rev = time[::-1]
    low_close = low_close[::-1]

    plotly.offline.plot({
        "data": [
        go.Scatter(x=time, y=list(reversed(ratio[:len(sma)])), name='Ratio', line=dict(color='rgb(0, 0, 0)')),
        go.Scatter(x=time, y=mean, name='Mean',line=dict(color='rgb(0, 0, 255)', dash='dot')),
 #This causes a rectangle (CHART 2):
        go.Scatter(x=time+time_rev, y=up_close+low_close, fill='tozerox', fillcolor='rgb(0,176,246)', name='Close Area',line=dict(color='rgb(255,255,255,0)')),

 #This plots the lines separately with no problem (CHART 1)
 #        go.Scatter(x=time, y=up_close, name='Close Area (Upper)',line=dict(color='rgb(0,176,246,0.2)')),
 #      go.Scatter(x=time_rev, y=low_close, name='Close Area (Lower)',line=dict(color='rgb(0,176,246,0.2)'))

 #This plots the vertical line at the end of the chart (CHART 3)
 #        go.Scatter(x=time+time_rev, y=up_close+low_close, name='Close Area',line=dict(color='rgb(0,176,246,0.2)')),

        ], "layout": go.Layout(title='Test with Mean + STD')
        }, auto_open=True)

我在情节(和绘图库)方面有点新意,所以我可能会监督它 . 有人可以解雇一些吗?

提前致谢 .