Bokeh autofill datetime axis missing values: how to stop it?

I’m trying to build an interactive plot from a pandas dataframe
of financial data. The dataframe index has some gap when market are closed, or during weekends. The problem is that Bokeh always autofill those gaps when I use the dataframe index as xasis, making it visually ugly.

How can I print my data without gaps? In my index I don’t have datetime values for when the markets are closed, or weekends or holidays, but it’s like Bokeh automatically creates them just to connect the y value of the last
day that I have, with the first y value of the next day.

I don’t think that possible out-of-the-box. You need a non-continuous axis, and only non-continuous axis that Bokeh offers is CategoricalAxis that is definitely not for your case.
A workaround would be to patch the data itself to make it continuous, and then set a custom ticker for the x-axis that would display all values continuously, apart from those gaps

Regards,

Eugene

···

On Wednesday, January 31, 2018 at 11:54:07 PM UTC+7, Thomas Cercato wrote:

I’m trying to build an interactive plot from a pandas dataframe
of financial data. The dataframe index has some gap when market are closed, or during weekends. The problem is that Bokeh always autofill those gaps when I use the dataframe index as xasis, making it visually ugly.

How can I print my data without gaps? In my index I don’t have datetime values for when the markets are closed, or weekends or holidays, but it’s like Bokeh automatically creates them just to connect the y value of the last
day that I have, with the first y value of the next day.

Here is an example someone contributed a long time ago that does that:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py

As noted, it's not "out of the box" basically you will have to use the integer index as the x-axis and then add tick label overrides to label them as dates.

Thanks,

Bryan

···

On Jan 31, 2018, at 11:02, Eugene Pakhomov <[email protected]> wrote:

I don't think that possible out-of-the-box. You need a non-continuous axis, and only non-continuous axis that Bokeh offers is CategoricalAxis that is definitely not for your case.
A workaround would be to patch the data itself to make it continuous, and then set a custom ticker for the x-axis that would display all values continuously, apart from those gaps

Regards,
Eugene

On Wednesday, January 31, 2018 at 11:54:07 PM UTC+7, Thomas Cercato wrote:

I'm trying to build an interactive plot from a pandas dataframe of financial data. The dataframe index has some gap when market are closed, or during weekends. The problem is that Bokeh always autofill those gaps when I use the dataframe index as xasis, making it visually ugly.

How can I print my data without gaps? In my index I don't have datetime values for when the markets are closed, or weekends or holidays, but it's like Bokeh automatically creates them just to connect the y value of the last day that I have, with the first y value of the next day.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/35501152-1bb8-457f-8c54-25bd138a729c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.