Setting Ranges
Ranges define what the plot's axes show: the data range, factor (categorical) range, and how far the user can pan/zoom. You set them at figure creation or on the axes afterward, and you can constrain zoom behavior so the plot stays useful.
Basic Ranges in figure()
from bokeh.plotting import figure
p = figure(x_range=(0, 100), y_range=(-10, 10))
# or named Range objects:
from bokeh.models import Range1d
p2 = figure(x_range=Range1d(start=0, end=50, bounds=(0, 50)))
p3 = figure(x_range=Range1d(start=0, end=50, min_interval=1))
FactorRange for Categories
from bokeh.plotting import figure
cats = ["A", "B", "C", "D"]
p = figure(x_range=cats) # shorthand for FactorRange(factors=cats)
p.vbar(x=cats, top=[12, 19, 7, 15], width=0.6, fill_color="#d4af37")
Setting the Axis Range Directly
from bokeh.models import Range1d
p.x_range = Range1d(-5, 55)
p.y_range.start = -2
p.y_range.end = 12
Zoom and Pan Constraints
from bokeh.models import Range1d
# fixed bounds: zooming cannot go past them
p.x_range = Range1d(start=0, end=100, bounds=(0, 100), min_interval=5)
# no panning at all:
p.add_tools("pan") # then remove pan: use a tool list without "pan"
from bokeh.plotting import figure
p2 = figure(tools="") # no tools at all
p3 = figure(tools="wheel_zoom,reset")
Resetting the View
from bokeh.models import ResetTool
p.add_tool(ResetTool()) # "reset" button in the toolbar
# programmatically restore defaults:
p.x_range.start = 0
p.x_range.end = 100
Summary
Set plot ranges with figure(x_range=..., y_range=...) using tuples, Range1d (with bounds/min_interval for zoom constraints), or FactorRange for categories. Adjust p.x_range/p.y_range after creation, control toolbar tools with the tools argument, and add ResetTool so users can restore the default view.