geomappy.plotting.shapes.plot_classified_shapes
- geomappy.plotting.shapes.plot_classified_shapes(df: GeoDataFrame | GeoSeries | None = None, lat: ndarray | None = None, lon: ndarray | None = None, values: str | float | ndarray | None = None, s: float | ndarray | None = None, levels: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, colors: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, cmap: str | Colormap = 'Set1', nan_color: tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None = None, labels: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, ax: Axes | None = None, legend: str | LegendCreator | None = 'colorbar', legend_ax: Axes | None = None, linewidth: float = 1, **kwargs) tuple[list[Collection], Colorbar | Legend | None]
Plot discrete-class shapes (choropleth style).
- Parameters:
df (
GeoDataFrameorGeoSeries, optional) – GeoDataFrame/GeoSeries containing the geometries.lat (array_like, optional) – Latitude and longitude values when df is not provided.
lon (array_like, optional) – Latitude and longitude values when df is not provided.
values (array_like, numeric, or str) – Values used for classification. If df is given and values is a string, it refers to a column name.
s (array_like, optional) – Size of each geometry marker.
levels (array_like, optional) – Classification levels. If None, inferred from values.
colors (array_like, optional) – List of colors corresponding to levels. Overrides cmap.
cmap (
Colormapor str, optional) – Colormap used if colors are not provided.nan_color (
ColorType, optional) – Color for NaN values.labels (array_like, optional) – Labels for the classes.
ax (
Axes, optional) – Axes for plotting. If None, created automatically.legend ({‘legend’, ‘colorbar’, None} or
LegendCreator, optional) – Legend type to display.legend_ax (
Axes, optional) – Axes for the legend.linewidth (float, optional) – Line width for geometry borders.
**kwargs – Additional keyword arguments passed to _plot_geometries. facecolor is not supported for classified shapes.
- Returns:
collections (list of
Collection)
Notes
When providing a GeoAxes in ax, provide extent if the axes and data do not perfectly overlap. If plotting with a different projection, provide transform.