Problem
An explicit axis domain=(lo, hi) defines the initial visible range, but it does not constrain later interaction. Users can pan the plot completely or partially outside that domain, leaving a chart half-visible or empty.
Disabling pan and zoom entirely addresses static charts (#80), but exploratory charts need a middle ground: allow navigation while preventing the camera from leaving meaningful data bounds.
Reproduction
chart = xy.bar_chart(
xy.bar(["A", "B", "C"], [10, 20, 30]),
xy.x_axis(domain=(0, 30)),
)
Plain-drag can move the viewport beyond (0, 30); the domain is treated as an initial view rather than a hard boundary.
Proposed API
Support separate navigation bounds, for example:
xy.x_axis(domain=(0, 30), bounds=(0, 30))
xy.y_axis(bounds="data")
Expected behavior:
- Pan is clamped so the visible window cannot leave the configured bounds.
- Zoom-out is clamped to the maximum bounded extent.
- Zoom-in remains available within the bounds.
- Reversed and log axes preserve their existing semantics.
domain remains the initial view for backward compatibility.
bounds=None preserves today's unrestricted navigation.
This is distinct from disabling interaction: it keeps exploratory charts useful without allowing users to lose the data.
Problem
An explicit axis
domain=(lo, hi)defines the initial visible range, but it does not constrain later interaction. Users can pan the plot completely or partially outside that domain, leaving a chart half-visible or empty.Disabling pan and zoom entirely addresses static charts (#80), but exploratory charts need a middle ground: allow navigation while preventing the camera from leaving meaningful data bounds.
Reproduction
Plain-drag can move the viewport beyond
(0, 30); the domain is treated as an initial view rather than a hard boundary.Proposed API
Support separate navigation bounds, for example:
Expected behavior:
domainremains the initial view for backward compatibility.bounds=Nonepreserves today's unrestricted navigation.This is distinct from disabling interaction: it keeps exploratory charts useful without allowing users to lose the data.