gsplot.inset#
- inset(parent, bounds, *, label=None, zoom=False, style='paper', zorder=5, zoom_zorder=None)#
Create a publication-styled inset on an explicit parent Axes.
- Parameters:
parent (Axes) β Matplotlib Axes that owns the child and optional zoom indicator.
bounds (tuple[float, float, float, float] | InsetSpec) β Normalized
(left, bottom, width, height)parent-Axes fractions, or an advancedgsplot.InsetSpecplacement.label (tuple[str, str] | tuple[str, str, Any, Any] | Sequence[Any] | None) β Optional
(xlabel, ylabel)or(xlabel, ylabel, xlim, ylim)record. Label padding is zero points.zoom (bool | tuple[tuple[int, int], tuple[int, int]]) β
Falsefor no indicator,Truefor Matplotlibβs automatic indicator, or exactly two(parent_corner, inset_corner)pairs. Corner identifiers are 1 upper-right, 2 upper-left, 3 lower-left, and 4 lower-right.style (Literal['paper'] | None) β Apply the target-local
"paper"profile by default, or useNoneto retain ambient Matplotlib styling.zorder (float) β Finite child Axes z-order, defaulting to
5.zoom_zorder (float | None) β Optional finite indicator z-order. The default is
zorder - 0.01and is valid only whenzoomis enabled.
- Returns:
Newly created native child Axes.
- Return type:
matplotlib.axes.Axes- Raises:
LayoutError β If the parent, placement, label, zoom controls, style, or z-orders are invalid, or Matplotlib cannot create the requested inset.
Notes
Every option is validated before child creation. Indicator artists belong to the parent Axes and track the childβs limits. This function does not run a Figure layout engine or change global Matplotlib state.
Examples
>>> import gsplot as gs >>> figure, ax = gs.subplots() >>> child = gs.inset(ax, (0.6, 0.6, 0.3, 0.3), label=("x", "y")) >>> child.figure is figure True >>> figure.clear()