With the help from another thread, I was able to come up with the following code which generates a quad type of graph.
I was trying to control the ticks of the plot. I tried the FixedTicker method, but that doesn’t seem to be working for my datetime axis. It seems like FixedTicker accepts Floats only. Do you know any workaround to this?
Here is my code:
import datetime
from bokeh.plotting import figure, show, output_file
from bokeh.models import FixedTicker
df=pd.DataFrame({“Start”:[datetime.datetime(2016, 3, 17, 15, 46, 2, 763666),
datetime.datetime(2016, 3, 17, 15, 46, 8, 74970),
datetime.datetime(2016,3, 17, 15, 46, 11, 323156)],
“End”:[datetime.datetime(2016, 3, 17, 15, 46, 3, 371701),
datetime.datetime(2016, 3, 17, 15, 46, 8, 138974),
datetime.datetime(2016, 3, 17, 15, 46, 11, 723179)]})
times=[datetime.datetime(2016, 3, 17, 15, 46, 2, 763666),
datetime.datetime(2016, 3, 17, 15, 46, 3, 371701),
datetime.datetime(2016, 3, 17, 15, 46, 8, 74970),
datetime.datetime(2016, 3, 17, 15, 46, 8, 138974),
datetime.datetime(2016,3, 17, 15, 46, 11, 323156),
datetime.datetime(2016, 3, 17, 15, 46, 11, 723179)]
p = figure(x_axis_type=‘datetime’, plot_height=100, plot_width=500, responsive=True, title=“Motion graph”, tools=‘reset’)
p.yaxis.minor_tick_line_color = None
p.ygrid[0].ticker.desired_num_ticks = 1
p.xaxis[0].ticker=FixedTicker(ticks=times)
y1 = p.quad(left=df[‘Start’],right=df[‘End’],bottom=0, top=1 )
output_file(“time_interval.html”)
show(p)
``