This is probably a trivial question but I cannot figure it out. I have a line chart with x_axis_type=“datetime” and I want to draw a vertical line at specific points in time where certain events are occurring.
I don’t see any example like this in the gallery but I thought ray might do the trick.
I’m using code similar to the below, with data being a pandas data frame with data[0] being a pandas.tslib.Timestamp, and data[1] being a float.
figure(plot_height = plotHeight,
plot_width = plotWidth,
x_axis_type = "datetime",
tools="pan,wheel_zoom,box_zoom,reset,previewsave")
hold()
line(
data[0], # x coordinates
data[1], # y coordinates
plot_width=plotWidth, # width
plot_height=plotHeight, # height
color="blue", # set a color for the line
legend=label, # attach a legend label
)
ray(
event,
0,
90,
500,
color = "red")
show()
Unfortunately when I use a pandas.tslib.Timestamp for the x coordinate of a ray the library crashes:
/Library/Python/2.7/site-packages/bokeh/plotting_helpers.pyc in _match_data_params(argnames, glyphclass, datasource, serversource, args, kwargs)
139 glyph_val = {'field' : var, 'units' : units}
140 else:
--> 141 raise RuntimeError("Unexpected column type: %s" % type(val))
142 glyph_params[var] = glyph_val
143 return glyph_params
RuntimeError: Unexpected column type: <class 'pandas.tslib.Timestamp'>
Is it possible to draw a vertical line in a time series chart with Bokeh, and if so what is the correct approach?
Thanks!
Jason