out_map.MapRenderer.choropleth_plt
tools.out_map.MapRenderer.choropleth_plt(
ax,
geo,
time,
quantity,*,
=None,
borders=None,
cmap=None,
proj=None,
transform=None,
vmax=None,
vmin )
Draws a choropleth map onto the given matplotlib Axes showing the given selections. This is a variant of the method choropleth()
that gives you more control over the rendering of a plot by letting you do most of the work with matplotlib’s API. See that method for conditions that must be met to use this method effectively.
Parameters
ax: matplotlib.axes.Axes
-
the plot axes on which to draw the map
geo:
GeoSelection
|GeoAggregation
-
the geographic selection to make on the output data
time:
TimeSelection
|TimeAggregation
-
the time selection to make on the output data
quantity: QuantitySelection | QuantityAggregation
-
the quantity selection to make on the output data
borders:
GeoSelection
|GeoGroup
= None-
if given, use this geography to draw dark borders, this could be the same or different geography from
geo
; if None (default), no borders are drawn cmap: Any | None = None
-
the color map to use for the plot; you can pass any value you would normally pass to
geopandas.GeoDataFrame.plot()
proj:
CRS
| str = None-
the projection to use for mapping; if None (default) we will map using the default projection for the source geography (for US Census, this is NAD83 https://epsg.org/crs_4269/index.html)
transform: Callable[[pd.DataFrame], pd.DataFrame] = None
-
allows you to specify an arbitrary transform function on the source dataframe before we plot it, e.g., to rescale the values. The dataframe given as the argument is the result of applying all selections and the projection if specified. You should return a dataframe with the same format, where the data column has been modified for your purposes.
Dataframe columns: - “geo”: the node ID of each polygon - “data”: the data value from the quantity selection
vmax: float = None
-
the max value for the color map, by default the max value of the data
vmin: float = None
-
the min value for the color map, by default the min value of the data
Returns
tuple[
GeoDataFrame
, ScalarMappable]-
a tuple with 1. the GeoDataFrame containing the data used to render the map and 2. the ScalarMappable used as the map’s color scale