pypsa.plot.add_legend_patches

pypsa.plot.add_legend_patches#

pypsa.plot.add_legend_patches(ax: Axes, colors: list[str] | ndarray, labels: list[str] | ndarray, patch_kw: dict[str, Any] | None = None, legend_kw: dict[str, Any] | None = None) Legend#

Add patches for color references.

Parameters:
  • ax (matplotlib ax) – Matplotlib axis to add the legend to.

  • colors (list-like, float) – Color of the patch; for example [“r”, “g”, “b”]

  • labels (list-like, str) – Label of the patch; for example [“wind”, “solar”, “gas”]

  • patch_kw (defaults to {}) – Keyword arguments passed to matplotlib.patches.Patch

  • legend_kw (defaults to {}) – Keyword arguments passed to ax.legend