pypsa.plot.add_legend_lines

pypsa.plot.add_legend_lines#

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

Add a legend for lines and links.

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

  • sizes (list-like, float) – Size of the line reference; for example [3, 2, 1]

  • labels (list-like, str) – Label of the line reference; for example [“30 GW”, “20 GW”, “10 GW”]

  • colors (list-like, str) – Color of the line reference; for example [“red, “green”, “blue”]

  • patch_kw (defaults to {}) – Keyword arguments passed to plt.Line2D

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