As Bokeh does not support tooltips for BoxAnnotations, my workaround is to add a Quad to the figure and attach a HoverTool to the Quad. How could I make the quad always span from the top to the bottom of the figure, regardless of the zooming?
The default DataRange1d
ranges have a renderers
property that you can set to explicitly list the renderers that should be auto-ranged over. In this case you can set it to leave out the quad:
from bokeh.models import BoxAnnotation
from bokeh.plotting import figure, show
p = figure()
r = p.circle([1,2,3], [2,5,3])
p.quad(left=1.5, right=2.5, top=10e8, bottom=-10e8, alpha=0.2)
# add in all the renderers except the quad
p.y_range.renderers = [r]
show(p)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.