Created
April 14, 2017 08:55
-
-
Save JaimeEnergy/4ed0f3a9d58d6764230a14848b29e9ab to your computer and use it in GitHub Desktop.
Bokeh background rectangle that covers an entire plot including panable area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def d64(start, end): | |
""" find the midpoints of two dates and return as numpy int64""" | |
midpoint = start + (end-start)/2 | |
print(start, end, midpoint) | |
return np.datetime64(midpoint).astype('datetime64[ms]').view(np.int64) | |
xrange = Range1d(q.start_dt,q.end_dt) | |
plot = figure(plot_width=850, plot_height=100, x_range=xrange) | |
plot.xaxis[0].ticker = DatetimeTicker() | |
mini, maxi = df.start.min(), df.finish.max() | |
plot.rect( | |
x = d64(mini, maxi), | |
y = plot_height/2, | |
width=(maxi-mini).total_seconds()*1000, | |
height = plot_height, | |
color = '#%02x%02x%02x' % (r, g, b), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment