Matplotlib interface (cartopy.mpl)

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


The most primitive extension is the cartopy.mpl.geoaxes.GeoAxes class, which extends a Matplotlib Axes and adds a transform keyword argument to many plotting methods to enable geographic projections and boundary wrapping to occur on the axes.

geoaxes.GeoAxes(*args, **kwargs)

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

geoaxes.GeoAxesSubplot(fig, *args, **kwargs)

geoaxes.GeoSpine(axes, **kwargs)


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.Gridliner(axes, crs[, ...])

ticker.LongitudeFormatter([direction_label, ...])

Tick formatter for a longitude axis.

ticker.LatitudeFormatter([direction_label, ...])

Tick formatter for latitude axes.

ticker.LongitudeLocator([nbins, dms])

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

ticker.LatitudeLocator([nbins, dms])

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

Artist extensions

Features and images can be added to a cartopy.mpl.geoaxes.GeoAxes through an extension of the Matplotlib Artist interfaces.

feature_artist.FeatureArtist(feature, **kwargs)

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

slippy_image_artist.SlippyImageArtist(ax, ...)

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

Additional extensions

Extra functionality that is primarily intended for developers. They describe some of the capabilities for transforming between GEOS, Shapely, and Matplotlib paths.


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

patch.path_segments(path, **kwargs)

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

patch.path_to_geos(path[, force_ccw])

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