API Reference¶
Plots¶
- geoplot.pointplot(projection=None, hue=None, cmap=None, norm=None, scheme=None, scale=None, limits=(1, 5), scale_func=None, legend=False, legend_var=None, legend_values=None, legend_labels=None, legend_kwargs=None, figsize=(8, 6), extent=None, ax=None, **kwargs)¶
A geospatial scatter plot.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) – If
hue
is specified, the colormap to use.norm (function, optional) – A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – If
hue
is specified, the categorical binning scheme to use.scale (str or iterable, optional) – The column in the dataset (or an iterable of some other data) with which to scale output points. For a reference on this and the other scale-related parameters that follow, see Scale.
limits ((min, max) tuple, optional) – If
scale
is set, the minimum and maximum size of the points.scale_func (ufunc, optional) – If
scale
is set, the function used to determine the size of each point. For reference see the Pointplot of US city elevations with custom scale functions demo.legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_var ("hue" or "scale", optional) – Which variable,
hue
orscale
, to use in the legend.legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) – Keyword arguments to be passed to the underlying matplotlib.pyplot.scatter instance.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.polyplot(projection=None, extent=None, figsize=(8, 6), ax=None, **kwargs)¶
A trivial polygonal plot.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) – Keyword arguments to be passed to the underlying Matplotlib Polygon patches.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.webmap(extent=None, figsize=(8, 6), projection=None, zoom=None, provider={'attribution': '(C) OpenStreetMap contributors', 'max_zoom': 19, 'name': 'OpenStreetMap.Mapnik', 'url': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'}, ax=None, **kwargs)¶
A webmap.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
webmap
only supports a single projection:WebMercator
.extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
zoom (None or int) – The zoom level to use when fetching webmap tiles. Higher zoom levels mean more detail, but will also take longer to generate and will have more clutter. There are generally only two or three zoom levels that are appropriate for any given area. For reference see the OpenStreetMaps reference on zoom levels.
provider (contextily.providers object) – The tile provider. If no provider is set, the default OpenStreetMap tile service, contextily.providers.OpenStreetMap.Mapnik, will be used. For reference see the contextily documentation.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) –
Keyword arguments to be passed to the underlying Matplotlib Polygon patches.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.choropleth(projection=None, hue=None, cmap=None, norm=None, scheme=None, legend=False, legend_kwargs=None, legend_labels=None, legend_values=None, extent=None, figsize=(8, 6), ax=None, **kwargs)¶
A color-mapped area plot.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) –
The colormap to use.
norm (function, optional) –
A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – The categorical binning scheme to use.
legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) –
Keyword arguments to be passed to the underlying Matplotlib Polygon patches.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.kdeplot(projection=None, extent=None, figsize=(8, 6), ax=None, clip=None, **kwargs)¶
A kernel density estimate isochrone plot.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
cmap (matplotlib color, optional) –
The colormap to use.
clip (None or iterable or GeoSeries, optional) – If specified, isochrones will be clipped to the boundaries of this geometry.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) – Keyword arguments to be passed to the underlying seaborn.kdeplot instance.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.cartogram(projection=None, scale=None, limits=(0.2, 1), scale_func=None, hue=None, cmap=None, norm=None, scheme=None, legend=False, legend_values=None, legend_labels=None, legend_kwargs=None, legend_var=None, extent=None, figsize=(8, 6), ax=None, **kwargs)¶
A scaling area plot.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
scale (str or iterable, optional) – The column in the dataset (or an iterable of some other data) with which to scale output points. For a reference on this and the other scale-related parameters that follow, see Scale.
limits ((min, max) tuple, optional) – If
scale
is set, the minimum and maximum size of the points.scale_func (ufunc, optional) – If
scale
is set, the function used to determine the size of each point. For reference see the Pointplot of US city elevations with custom scale functions demo.hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) –
If
hue
is specified, the colormap to use.norm (function, optional) –
A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – If
hue
is specified, the categorical binning scheme to use.legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_var ("hue" or "scale", optional) – Which variable,
hue
orscale
, to use in the legend.legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) –
Keyword arguments to be passed to the underlying Matplotlib Polygon patches.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.sankey(projection=None, hue=None, norm=None, cmap=None, scheme=None, legend=False, legend_kwargs=None, legend_labels=None, legend_values=None, legend_var=None, extent=None, figsize=(8, 6), scale=None, scale_func=None, limits=(1, 5), ax=None, **kwargs)¶
A spatial Sankey or flow map.
- Parameters
df (GeoDataFrame, optional) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) –
If
hue
is specified, the colormap to use.norm (function, optional) –
A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – If
hue
is specified, the categorical binning scheme to use.scale (str or iterable, optional) – The column in the dataset (or an iterable of some other data) with which to scale output points. For a reference on this and the other scale-related parameters that follow, see Scale.
limits ((min, max) tuple, optional) – If
scale
is set, the minimum and maximum size of the points.scale_func (ufunc, optional) – If
scale
is set, the function used to determine the size of each point. For reference see the Pointplot of US city elevations with custom scale functions demo.legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_var ("hue" or "scale", optional) – Which variable,
hue
orscale
, to use in the legend.legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) – Keyword arguments to be passed to the underlying matplotlib.lines.Line2D instances.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.quadtree(projection=None, clip=None, hue=None, cmap=None, norm=None, scheme=None, nmax=None, nmin=None, nsig=0, agg=<function mean>, legend=False, legend_kwargs=None, legend_values=None, legend_labels=None, extent=None, figsize=(8, 6), ax=None, **kwargs)¶
A choropleth with point aggregate neighborhoods.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
clip (None or iterable or GeoSeries, optional) – If specified, quadrangles will be clipped to the boundaries of this geometry.
hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) –
If
hue
is specified, the colormap to use.norm (function, optional) –
A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – The categorical binning scheme to use.
nmax (int or None, optional) – The maximum number of observations in a quadrangle.
nmin (int, optional) – The minimum number of observations in a quadrangle.
nsig (int, optional) – The minimum number of observations in a quadrangle. Defaults to 0 (only empty patches are removed).
agg (function, optional) – The aggregation func used for the colormap. Defaults to
np.mean
.legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) –
Keyword arguments to be passed to the underlying Matplotlib Polygon patches.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
- geoplot.voronoi(projection=None, clip=None, hue=None, cmap=None, norm=None, scheme=None, legend=False, legend_kwargs=None, legend_labels=None, legend_values=None, extent=None, edgecolor='black', figsize=(8, 6), ax=None, **kwargs)¶
A geospatial Voronoi diagram.
- Parameters
df (GeoDataFrame) – The data being plotted.
projection (geoplot.crs object instance, optional) – The projection to use. For reference see Working with Projections.
clip (None or iterable or GeoSeries, optional) – If specified, the output will be clipped to the boundaries of this geometry.
hue (None, Series, GeoSeries, iterable, or str, optional) – The column in the dataset (or an iterable of some other data) used to color the points. For a reference on this and the other hue-related parameters that follow, see Hue.
cmap (matplotlib color, optional) –
If
hue
is specified, the colormap to use.norm (function, optional) –
A colormap normalization function which will be applied to the data before plotting.
scheme (None or mapclassify object, optional) – If
hue
is specified, the categorical binning scheme to use.scale (str or iterable, optional) – The column in the dataset (or an iterable of some other data) with which to scale output points. For a reference on this and the other scale-related parameters that follow, see Scale.
limits ((min, max) tuple, optional) – If
scale
is set, the minimum and maximum size of the points.scale_func (ufunc, optional) – If
scale
is set, the function used to determine the size of each point. For reference see the Pointplot of US city elevations with custom scale functions demo.legend (boolean, optional) – Whether or not to include a map legend. For a reference on this and the other legend-related parameters that follow, see Legend.
legend_values (list, optional) – The data values to be used in the legend.
legend_labels (list, optional) – The data labels to be used in the legend.
legend_var ("hue" or "scale", optional) – Which variable,
hue
orscale
, to use in the legend.legend_kwargs (dict, optional) – Keyword arguments to be passed to the underlying legend.
extent (None or (min_longitude, min_latitude, max_longitude, max_latitude), optional) – Controls the plot extents. For reference see Extent.
figsize ((x, y) tuple, optional) – Sets the size of the plot figure (in inches).
ax (AxesSubplot or GeoAxesSubplot instance, optional) – If set, the
matplotlib.axes.AxesSubplot
orcartopy.mpl.geoaxes.GeoAxesSubplot
instance to paint the plot on. Defaults to a new Axes.kwargs (dict, optional) – Keyword arguments to be passed to the underlying Matplotlib Line2D objects.
- Returns
The plot Axes.
- Return type
AxesSubplot
orGeoAxesSubplot
Projections¶
- crs.PlateCarree()¶
Form a CRS that centers by longitude.
- crs.LambertCylindrical()¶
Form a CRS that centers by longitude.
- crs.Mercator()¶
Form a CRS that centers by longitude.
- crs.WebMercator()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.Miller()¶
Form a CRS that centers by longitude.
- crs.Mollweide()¶
Form a CRS that centers by longitude.
- crs.Robinson()¶
Form a CRS that centers by longitude.
- crs.Sinusoidal()¶
Form a CRS that centers by longitude.
- crs.InterruptedGoodeHomolosine()¶
Form a CRS that centers by longitude.
- crs.Geostationary()¶
Form a CRS that centers by longitude.
- crs.NorthPolarStereo()¶
Form a CRS that centers by longitude.
- crs.SouthPolarStereo()¶
Form a CRS that centers by longitude.
- crs.Gnomonic()¶
For a CRS that centers by latitude.
- crs.AlbersEqualArea()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.AzimuthalEquidistant()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.LambertConformal()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.Orthographic()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.Stereographic()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.TransverseMercator()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.LambertAzimuthalEqualArea()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.OSGB()¶
Form a CRS that accepts neither longitude or latitude centering.
- crs.EuroPP()¶
Form a CRS that accepts neither longitude or latitude centering.
- crs.OSNI()¶
Generate instances of
cartopy.crs
.*name* where name matches the instance’s class name.- Parameters
load (Return a Cartopy CRS initialized with defaults from the centerings dictionary,) –
by initialization parameters. (overridden) –
_as_mpl_axes (Return the result of calling cartopy’s
_as_mpl_axes
for self.load) –with empty df and centerings. (called) –
- crs.EckertI()¶
Form a CRS that centers by longitude.
- crs.EckertII()¶
Form a CRS that centers by longitude.
- crs.EckertIII()¶
Form a CRS that centers by longitude.
- crs.EckertIV()¶
Form a CRS that centers by longitude.
- crs.EckertV()¶
Form a CRS that centers by longitude.
- crs.EckertVI()¶
Form a CRS that centers by longitude.
- crs.NearsidePerspective()¶
Form a CRS that accepts neither longitude or latitude centering.