I have a timeseries which times are in UTC, that I can show like that:
from bokeh.plotting import show, figure, output_notebook
from bokeh.models import ColumnDataSource as CDS, LinearAxis, Range1d,DatetimeTickFormatter
import pandas as pd
import pytz
import numpy as np
from datetime import timedelta
output_notebook()
index=pd.date_range('2018-1-1','2018-1-2',freq='H',tz='UTC')
data=np.random.rand(len(index))
df=pd.DataFrame(data,index,columns=['data']).reset_index()
source=CDS(df.to_dict('list'))
f=figure(width=900,height=250,x_axis_type='datetime')
f.xaxis[0].ticker.desired_num_ticks=24
f.line('index','data',source=source)
show(f)
``
However, I would like to be able to add an additional x axis showing the datetime in a different timezone.
I tried:
tz = pytz.timezone('US/Eastern')
f.extra_x_ranges = {"orig_tz": Range1d(
start=source.data['index'][0].astimezone(tz),
end=source.data['index'][0].astimezone(tz)+timedelta(days=1) )}
f.add_layout(LinearAxis(x_range_name="orig_tz", formatter=DatetimeTickFormatter(hours='%Hh')), 'below')
f.xaxis[1].ticker.desired_num_ticks=24
show(f)
``
But this displays:
We can see that the second x axis starts at 1/1/2018 00:00:00 when its should start with the offset of 6 hours at 31/12/2017 18:00:00. It similarly ends on the wrong time (1/1/2018 00:00:00 instead of 1/1/2018 18:00:00)
I tried to check / change the start and end values inf.extra_x_ranges['orig_tz']['property_values] but i see they are correctly set.
How can I correctly display the second axis with (here in that example) a shift of 6 hours ?

