【问题标题】:python use plotly to plot time series without date gapspython 使用 plotly 绘制没有日期间隔的时间序列
【发布时间】:2016-03-10 04:53:43
【问题描述】:

我正在使用 python3。我有一个 1 分钟频率的报价系列。报价仅在交易时间内可用。我尝试使用 plotly 来绘制它,但在非交易时间和周末存在差距。我怎样才能使这个情节连续?

我的代码是这样的

ifBasisPlot=go.Scatter( x=ifBasis.date, y=ifBasis.basis, line=go.Line(width=1,color='blue'), name='basis' )

data = go.Data([ifBasisPlot])

ifBasisPlot_url = py.plot(data, filename='ifBasisPlot', auto_open=False,)

情节和数据在这里:https://plot.ly/~shuaihou96/14/if/

【问题讨论】:

    标签: python plotly


    【解决方案1】:

    我相信这个 plotly 项目有一个公开的 PR。 link

    正如 PR 中提到的,我们可以使用tickformat x 轴属性; @etpinard 制作了一个概念验证图表,但如果涉及缩放,这可能不起作用。

    【讨论】:

    • 你知道这方面是否有更新吗?我检查了链接,该项目现在似乎很接近,但我没有得到确切的解决方案......
    【解决方案2】:

    您可以尝试更改此代码

    ifBasisPlot=go.Scatter( x=ifBasis.date, y=ifBasis.basis, line=go.Line(width=1,color='blue'), name='basis' )
    

    进入

    ifBasisPlot=go.Scatter( x=range(len(ifBasis.date)), y=ifBasis.basis, line=go.Line(width=1,color='blue'), name='basis' )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-18
      相关资源
      最近更新 更多