gsplot.title#

title(ax, text, *, props=None, **kwargs)#

Set an explicit Axes title and return its native Text artist.

Parameters:
  • ax (Axes | _AxesBase) – Explicit target Axes.

  • text (str) – Title text.

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

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

Returns:

Native title artist attached to ax.

Return type:

matplotlib.text.Text

Raises:

PlotError – If the target, text, or property mapping is invalid.

Examples

>>> import gsplot as gs
>>> figure, ax = gs.subplots()
>>> text = gs.title(ax, "Signal")
>>> text.axes is ax
True
>>> figure.clear()