Matplotlib interface (cartopy.mpl)#

Cartopy extends some Matplotlib capabilities to handle geographic projections, such as non-rectangular axes and spines.

Geoaxes#

This module defines the cartopy.mpl.geoaxes.GeoAxes class, an extension of matplotlib which adds a transform keyword argument to many plotting methods to enable geographic projections and boundary wrapping to occur on the axes.

When a Matplotlib figure contains a GeoAxes the plotting commands can transform plot results from source coordinates to the GeoAxes’ target projection.

GeoAxes(*args, **kwargs)

A subclass of matplotlib.axes.Axes which represents a map Projection.

GeoAxesSubplot

alias of GeoAxes

GeoSpine(axes, **kwargs)

param axes:

The Axes instance containing the spine.

InterProjectionTransform(source_projection, ...)

Transform coordinates from the source_projection to the target_projection.

Gridlines and ticks#

Cartopy can produce gridlines and ticks in any projection and add them to the current geoaxes projection, providing a way to add detailed location information to the plots.

Gridliner(axes, crs[, draw_labels, ...])

Artist used by cartopy.mpl.geoaxes.GeoAxes.gridlines() to add gridlines and tick labels to a map.

Tools for handling tick marks in cartopy.

LongitudeFormatter([direction_label, ...])

Tick formatter for a longitude axis.

LatitudeFormatter([direction_label, ...])

Tick formatter for latitude axes.

LongitudeLocator([nbins, dms])

A locator for longitudes that works even at very small scale.

LatitudeLocator([nbins, dms])

A locator for latitudes that works even at very small scale.

Artist extensions#

This module defines the FeatureArtist class, for drawing Feature instances through an extension of the Matplotlib Artist interfaces.

FeatureArtist(feature, **kwargs)

A subclass of Collection capable of drawing a cartopy.feature.Feature.

Define the SlippyImageArtist class, which interfaces with cartopy.io.RasterSource instances at draw time, for interactive dragging and zooming of raster data.

SlippyImageArtist(ax, raster_source, **kwargs)

A subclass of AxesImage which provides an interface for getting a raster from the given object with interactive slippy map type functionality.

Patch#

Extra functionality that is primarily intended for developers, providing support for transforming between Shapely geometries and Matplotlib paths.

See also Shapely Geometric Objects and Matplotlib Path API.

geos_to_path(shape)

Create a list of matplotlib.path.Path objects that describe a shape.

path_segments(path, **kwargs)

Create an array of vertices and a corresponding array of codes from a matplotlib.path.Path.

path_to_geos(path[, force_ccw])

Create a list of Shapely geometric objects from a matplotlib.path.Path.