Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How to graph time-series data with a discontinuous x-axis?

Hi, I’m trying to use plotly for a financial application and I’d like to have a time-series graph over multiple days, however I only want to show 9:30 to 4:00 for each day (similar to what Google Finance does: (e.g. https://www.google.com/finance?q=NASDAQ%3AFB&ei=sAymVoHuBYWTmAGN-5GwBw)

Is there some way to specify this in a time-series chart?

The other idea I had was to keep the x-axis as a continuous integer and somehow override/relabel the x-axis markers, but I haven’t found a way to do that either.

Thanks for any help

Not at the moment.

This can be done using a combination of xaxis.tickvals and xaxis.ticktext ( https://plot.ly/javascript/reference/#layout-xaxis-tickvals and https://plot.ly/javascript/reference/#layout-xaxis-ticktext)

Hi,

I was about to ask the same question in the forum.
I think discontinuous time series for financial data would be a great new feature for plotly.

@etienne: Do you know if plotly developers plan to add this feature in a new release?

@jhendrix69: Did you manage to make this work more or less properly using ticktext/tickvals ?

Thanks a lot!

Hi,

I think this would be a very useful feature for financial data. I tried accomplishing this by changing the xaxis to integers and then using xaxis.tickvals/xaxis.ticktext but the results were far from ideal. For example, if I zoomed-in on a plot, all the lables would be lost.

@etienne: Is there any hope this feature will be added to plotly anytime soon?

Paul

I started using Plotly a few days ago. I am also trying to plot a chart of financial data, and have exactly the same problem. A google for “plotly discontinuous axis” has this page as the first hit!

My desire is slightly different, though. Rather than defining a fixed set of discontinuities upfront, i’d like to adapt them to the data. I’m plotting data from multiple exchanges, with different trading hours, where the user can select what to plot, so the time ranges which can be skipped over will depend on what they’ve selected. I don’t mind doing that calculation myself, but it would be most helpful to be able to change the discontinuities dynamically.