Python uses plotly to build time series without spaces in dates

I am using python3. I have a price series with 1 minute. Quotation is available only during trading hours. I tried to build it using a conspiracy, but there are gaps during non-working hours and weekends. How can I make this graph consistent?

My code is like

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

chart and data here: https://plot.ly/~shuaihou96/14/if/

+5
source share
2 answers

I believe that there is an open PR for the plot project. link

As mentioned in PR, we could use the axis attribute tickformat x; @etpinard proved a conceptual framework, but this may not work if zooming is involved.

0
source

You can try changing this code.

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

in

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

Source: https://habr.com/ru/post/1244787/


All Articles