ggtb ¶
ggtb(
size_basis: Optional[
Literal["x", "y", "min", "max"]
] = None,
size_zoomin: int | float | None = None,
) -> FeatureSpec
Add the zoom/pan toolbar to an HTML plot.
The toolbar sits above the plot. With a tool selected, dragging in a panel pans or zooms it and the mouse wheel zooms around the cursor; axes and grid lines are redrawn for the new range. Reset restores the original view.
Parameters:
-
size_basis((x, y, min, max), default:"x") –Which axis' zoom factor point sizes follow (the smaller or larger of both for
"min"/"max"). -
size_zoomin(int or float, default:0) –How much points grow when zooming in: 0 keeps their size, -1 grows them without limit, a positive number caps the growth factor.
Returns:
-
FeatureSpec–The toolbar feature (kind
"ggtoolbar").
Raises:
-
ValueError–If
size_basisis not one of the accepted names, orsize_zoominis not a finite number >= 0 or -1.
Examples:
>>> import ggrust as gg
>>> plot = gg.ggplot({"x": [1, 2, 3], "y": [3, 1, 2]}, gg.aes("x", "y")) + gg.geom_point()
>>> html = (plot + gg.ggtb(size_zoomin=-1)).to_html()