Matplotlib interface (cartopy.mpl)#

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

Geoaxes#

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(*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, ...])

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

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#

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

FeatureArtist(feature, **kwargs)

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

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.

Additional extensions#

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

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.