graphinglib.SmartFigure.set_custom_legend#
- SmartFigure.set_custom_legend(elements: Iterable[LegendElement] | None = None, reset: bool = False) Self[source]#
Sets a custom legend for the figure. If the SmartFigure contains multiple subplots, custom legends only work if the ``general_legend`` parameter is set to ``True``. Otherwise, custom legends can be added for non-general legends if the SmartFigure is currently used as a single plot (see the
is_single_subplotproperty).Note
The visibility of default or custom legend elements can be controlled individually with the
hide_default_legend_elementsandhide_custom_legend_elementsproperties.- Parameters:
- elementsIterable[LegendElement], optional
Iterable of
LegendElementobjects to add to the legend.- resetbool, optional
If
True, resets all previously set custom handles and labels before adding the new ones. Defaults toFalse.
- Returns:
- Self
For convenience, the same SmartFigure with the updated custom legend.