Bokeh 1.3.4
I am trying to use the Arrow annotation to plot rotating wind direction vectors.
As a simple mock-up to make things work, I am doing:
p = figure(
title="Wind Direction",
name="winddir_fig",
x_axis_type='datetime'
)
p.y_range=Range1d(0, 6)
cds.data['d2'] = cds.data['Date'] + pd.Timedelta(1,unit='hours')
arrows = Arrow(
end=OpenHead(size=15, line_color='black', line_width=2),
line_color="black", line_width=2,
x_start='Date', y_start=2, x_end='d2', y_end=4,
source=cds
)
p.add_layout(arrows)
My ColumnDataSource (cds
) is made from a Datetime-indexed Pandas dataframe, containing wind direction values, however in this mock-up I am just using the Datetime index to try and make the arrows work.
I added d2
to the cds
, which is a copy of the Datetime index (Date
) shifted forward one hour. I am trying to plot arrows that span 1-hr on the x-axis, and from 2 to 4 on the y-axis.
I get the following:
The arrows are plotting, but no line.
I also get:
W-1000 (MISSING_RENDERERS): Plot has no renderers: Figure(id='2228', ...)
Not sure what I am doing wrong?
As a follow-up question, I have traditionally used the ray
glyph to plot wind direction vectors, using the angle
attribute to rotate the lines. Because I cannot put arrows on the ray glyph, I am now trying Arrow
. Is there any way to rotate the Arrow
annotation using a rotation angle, instead of having to define start and end for both x and y?