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 overprops.
- Returns:
Native Text artists in normalized target order.
- Return type:
matplotlib.text.TextortupleofText- 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()