geomappy.plot_utils.legend_patches
- geomappy.plot_utils.legend_patches(colors: Sequence[tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]], labels: Sequence[str], *, legend_type: str = 'patch', edgecolor: str = 'lightgrey') list[Patch | Line2D]
Create legend handles for categorical data.
Can create solid patches or line handles depending on legend_type.
- Parameters:
colors (sequence of color-like) – Colors for each legend element.
labels (sequence of str) – Labels corresponding to each color.
legend_type (str, optional) – ‘patch’ for solid patches or a valid line style (‘-’, ‘–’, ‘:’, etc.) for line handles.
edgecolor (str, optional) – Edge color of patches or line markers.
- Returns:
List of legend handles.
- Return type: