Release: | 0.5.0 |
---|---|
Date: | ?? ???, 2012 |
This document explains the new/changed features of Cartopy in version 0.5.
Release 0.5 of Cartopy continues the work to expand the feature-set of Cartopy to encompass common operations, and provide performance improvements.
A summary of the main features added with version 0.5:
None
Features (i.e. collections of lines and polygons) are now added to a map via the add_feature() method.
Pre-defined features exist for the small-scale (1:110m) Natural Earth datasets detailed below:
Name | Description |
---|---|
BORDERS | Country boundaries. |
COASTLINE | Coastline, including major islands. |
LAKES | Natural and artificial lakes. |
LAND | Land polygons, including major islands. |
OCEAN | Ocean polygons. |
RIVERS | Single-line drainages, including lake centerlines. |
But any Natural Earth dataset can easily be used by creating an instance of cartopy.feature.NaturalEarthFeature.
For example, one can draw a map of Africa demonstrating all of the pre-defined features with the following code:
import cartopy
import matplotlib.pyplot as plt
ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAKES, alpha=0.5)
ax.add_feature(cartopy.feature.RIVERS)
ax.set_xlim((-20, 60))
ax.set_ylim((-40, 40))
plt.show()
(Source code, png)