Conditional Background Fill and timedelta plotting

Hi all,

First of all, I think Bokeh is awesome and I am really enjoying using it. I am just fiddling around right now but I have a couple of questions.

The data that I am plotting is a timeseries measured over a several days. There are several instance of measurements started on different days. In order to represent these measurements on the same plot and a common scale I have chosen to represent this timeseries as a timedelta from a relative time point in each instance. i.e. 1900 on the first day. I am using Pandas to carry out this correction.

The first question I have is: How can I use this timedelta as the x axis in a plot? Currently, I have converted the timedelta to seconds and plotted this but I get the feeling that there is a more elegant solution to this. I am using TImeSeries() to plot these data.

The second question I have is: Would it be possible to represent the day/night cycle as background colouring? I would very much like to have a visual representation of lights on/lights off. Something along the lines of different shading for each state. Currently I have translated the timedelta into a boolean column in the pandas dataframe but I have not got any further.

Since I am exploring I have been trying to emulate the High-level Charts examples but I would like to start making more bespoke charts but that is a story for another day.

Thanks very much!

Duncan

Hi all,

First of all, I think Bokeh is awesome and I am really enjoying using it. I am just fiddling around right now but I have a couple of questions.

Thanks for the kind words

The data that I am plotting is a timeseries measured over a several days. There are several instance of measurements started on different days. In order to represent these measurements on the same plot and a common scale I have chosen to represent this timeseries as a timedelta from a relative time point in each instance. i.e. 1900 on the first day. I am using Pandas to carry out this correction.

The first question I have is: How can I use this timedelta as the x axis in a plot? Currently, I have converted the timedelta to seconds and plotted this but I get the feeling that there is a more elegant solution to this. I am using TImeSeries() to plot these data.

I'd say that a datetime axis with a relative offset would be a nice feature, but it does not exist yet. That said, it is now possible to create user-defined models, so it ought to be possible for you to create your own custom TickFormatter class that formats the ticks based on a configured "starting point", and to replace the standard x-axis tick formatter with your custom one. If you are interested in this, one starting place is to look at

  https://github.com/bokeh/bokeh/blob/master/examples/models/custom.py

And see what questions you have.

The second question I have is: Would it be possible to represent the day/night cycle as background colouring? I would very much like to have a visual representation of lights on/lights off. Something along the lines of different shading for each state. Currently I have translated the timedelta into a boolean column in the pandas dataframe but I have not got any further.

The background, no, but you can use semi-transparent BoxAnnotations to create the same effect, I think. See, e.g.

  http://bokeh.pydata.org/en/latest/docs/gallery/box_annotation.html

Since I am exploring I have been trying to emulate the High-level Charts examples but I would like to start making more bespoke charts but that is a story for another day.

Great, let us know how we can help,

Bryan

ยทยทยท

On Jan 26, 2016, at 8:58 AM, Duncan Sneddon <[email protected]> wrote: