Limit bokeh panorama to a certain range

I was wondering if it is possible to limit the range of the pan tool for plotting on the bokeh. For example, let's say I had this simple plot:

from bokeh.plotting import output_file, rect, show
output_file('test.html')
rect([10,20,30], [10,20,30], width=[1,2,3], color=['red','blue','green'], height=5, plot_width=400, plot_height=400, tools = "ypan,box_zoom,reset")
show()

The ypan tool works fine, but I can continue to pan until my graph disappears. Is there a way to limit panning?

+4
source share
1 answer

The pan / zoom restriction function was added after this question was first asked.

y_range x_range bokeh a Range1d bounds, , .

from bokeh.plotting import figure
from bokeh.models import Range1d

fig = figure(y_range=Range1d(bounds=(0, 1)),
             x_range=Range1d(bounds=(0, 1)))

, Range1d , .


, , auto:

Range1d(0, 1, bounds="auto")
+4

Source: https://habr.com/ru/post/1537947/


All Articles