gsplot.panel_labels#

panel_labels(target, labels=None, *, loc='corner', props=None, **kwargs)#

Add deterministic labels to an explicit ordered panel collection.

Parameters:
  • target (Axes | _AxesBase | Sequence[Axes | _AxesBase] | Mapping[Any, Axes | _AxesBase] | ndarray[tuple[int, ...], dtype[Any]]) – Ordered Axes sequence or mapping whose values define panel order.

  • labels (Sequence[str] | None) – Optional labels with exactly one string per target Axes. Omitted labels are generated as A through Z, then AA onward.

  • loc (str) – Placement mode: "corner" places labels at a stable axes-relative corner, while "in" and "out" use the rendered Axes bounds to reproduce publication-style placement.

  • props (Mapping[str, Any] | None) – Optional finite Matplotlib Text property mapping.

  • **kwargs (Any) – Optional direct Matplotlib Text properties. Direct keyword arguments are merged with and take precedence over props.

Returns:

Native text artists added to the target Axes objects.

Return type:

tuple[matplotlib.text.Text, ]

Raises:

LayoutError – If the target, labels, or property mapping is invalid.

Examples

>>> import gsplot as gs
>>> figure, axes = gs.subplots(ncols=2)
>>> labels = gs.panel_labels(axes, labels=("A", "B"))
>>> len(labels)
2
>>> figure.clear()