gsplot.index#

index(target: Axes, labels: Sequence[str] | Mapping[object, str] | None = None, *, loc: Literal['in', 'out'] = 'out', offset: tuple[float, float] | float | None = None, xoffset: float | None = None, yoffset: float | None = None, size: float | str = 'large', props: Mapping[str, object] | None = None, **kwargs: Any) Text#
index(target: Axes | _AxesBase | Sequence[Axes | _AxesBase] | Mapping[Any, Axes | _AxesBase] | ndarray[tuple[int, ...], dtype[Any]], labels: Sequence[str] | Mapping[object, str] | None = None, *, loc: Literal['in', 'out'] = 'out', offset: tuple[float, float] | float | None = None, xoffset: float | None = None, yoffset: float | None = None, size: float | str = 'large', props: Mapping[str, object] | None = None, **kwargs: Any) Text | tuple[Text, ...]

Add deterministic lowercase panel indexes to explicit Axes.

Parameters:
  • target – One Axes or a deterministic same-Figure collection of Axes.

  • labels – Optional ordered labels or an exact-key mapping. Omitted values are generated as (a) through (z), then (aa) onward.

  • loc – "in" places text four points right/down from the upper-left Axes corner. "out" aligns the text’s left edge with the rendered left edge of the y-axis label and places it six points above the Axes.

  • offset – Optional point shift relative to baseline placement. Accepts a scalar for equal shift in x/y or a 2-tuple (dx, dy) in points.

  • xoffset – Optional direct point shift along the x-axis. Overrides the x component of offset.

  • yoffset – Optional direct point shift along the y-axis. Overrides the y component of offset.

  • size – Matplotlib font size. The default is the historical "large".

  • props – Optional closed Text property mapping. A font-size field conflicts with a separately supplied size.

  • **kwargs – Optional direct Matplotlib Text properties (e.g. color, fontweight, alpha). Direct keyword arguments are merged with and take precedence over props.

Returns:

Native Text artists in normalized target order.

Return type:

matplotlib.text.Text or tuple of Text

Raises:

LayoutError – If targets, labels, placement, size, or text properties are invalid.

Examples

>>> import gsplot as gs
>>> figure, axes = gs.subplots(1, 2)
>>> labels = gs.index(axes, loc="in", offset=(2, -2))
>>> tuple(item.get_text() for item in labels)
('(a)', '(b)')
>>> figure.clear()