gsplot.legend_entries#
- legend_entries(ax, *, handler_map=None)#
Return discovered handles and labels without creating or printing.
- Parameters:
ax (Axes) – Explicit target Axes.
handler_map (Mapping[Any, HandlerBase] | None) – Optional local handler mapping to carry into a later legend call.
- Returns:
Immutable tuples of native handles, labels, and handler data.
- Return type:
- Raises:
PlotError – If the target or handler mapping is invalid.
Examples
>>> import gsplot as gs >>> figure, ax = gs.subplots() >>> gs.line(ax, [0, 1], [0, 1], props={"label": "signal"}) [<matplotlib.lines.Line2D object ...>] >>> entries = gs.legend_entries(ax) >>> entries.labels ('signal',) >>> figure.clear()