pimpmyplot.legend#

pimpmyplot.legend(*args, shadow: bool = True, frameon: bool = True, loc: str = 'ext lower center', bbox_to_anchor: Tuple = None, edgecolor: str = 'k', ax: Axes = None, ncol: int = None, **kwargs) Legend[source]#

Enhanced matplotlib legend with support for external positioning and custom styling.

Parameters:
  • *args – Arguments passed to the standard ax.legend.

  • shadow (bool, optional) – Whether to draw a shadow behind the legend, by default True.

  • frameon (bool, optional) – Whether to draw a frame around the legend, by default True.

  • loc (str, optional) – The legend location. Supports standard matplotlib locations and ‘ext’ prefixed locations (e.g., ‘ext lower center’ or ‘ext side upper left’), by default ‘ext lower center’.

  • bbox_to_anchor (Tuple, optional) – The bounding box to anchor the legend to, by default None.

  • edgecolor (str, optional) – The color of the legend frame edge, by default ‘k’ (black).

  • ax (matplotlib.axes.Axes, optional) – The matplotlib axis to add the legend to. If None, uses the current axis (via @setupax).

  • ncol (int, optional) – Number of columns. If -1, sets to the number of labels. If None, it is inferred.

  • **kwargs – Additional keyword arguments passed to ax.legend.

Returns:

The created legend object.

Return type:

matplotlib.legend.Legend