X-Axis timezone ticks

I have a list of python datetime objects that are timezone aware (all of them have the same timezone), and they are the x coordinates of the points I want to plot. I am using a DatetimeTickFormatter to format these objects, and the ticks are the times in UTC, but I’d like to display the tick times in the timezone of these objects.
For example, if one of these objects is May 10, 2024, 13:00:00 in New York time, I’d like the tick under that point to be “13:00:00”, but right now, it’s “17:00:00”.

There’s not currently any timezone awareness in the axes, all datetimes are assume to be local. There’s been various ideas floated over the years regarding configuring timezones on axes, but none have yet been acted on.

But even with previous proposals, there was only ever a notion of an axis being configured for a single timezone. Your requirements are unique to me and I doubt they would ever be supported by Bokeh “out of the box”.

But Bokeh has features like CustomJSTickFormatter that afford you complete control over how the ticks are displayed, by supplying a snippet of JavaScript code to format the ticks however you need. I think this is definitely the approach you would need to use.

As for the tick locations, it’s not really clear what you are after. If you literally only want ticks right under (hopefully) a few specific objects, then you probably just want to use fixed tick locations, as described here. If that’s not what you want, you will need to describe your needs more thoroughly, with sample code, images, etc, to illustrate what exactly you are trying to accomplish.

Ok, the CustomJsTickFormatter solution worked. Thanks!

1 Like