.. _imcartopyrst: ======= cartopy ======= .. only:: html **Links:** :download:`notebook `, :downloadlink:`html `, :download:`PDF `, :download:`python `, :downloadlink:`slides `, :githublink:`GitHub|_doc/notebooks/2016/pydata/im_cartopy.ipynb|*` *cartopy* aims at drawing maps based on `matplotlib `__. It superimposes a geographical coordinate system on the top of matplotlib’s one. It is usually used with modules such as `pyproj `__ to handle `shapefiles `__ also with `shapely `__ or `geopandas `__, `fiona `__, `descartes `__. `documentation `__ `source `__ `installation `__ `tutorial `__ `gallery `__ .. code:: ipython3 %matplotlib inline .. code:: ipython3 from jyquickhelper import add_notebook_menu add_notebook_menu() .. contents:: :local: example ------- .. code:: ipython3 import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt fig = plt.figure(figsize=(7,7)) ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) ax.set_extent([-5, 10, 42, 52]) ax.add_feature(cfeature.OCEAN) ax.add_feature(cfeature.COASTLINE) ax.add_feature(cfeature.RIVERS) ax.add_feature(cfeature.LAKES) ax.add_feature(cfeature.LAND) ax.add_feature(cfeature.BORDERS, linestyle=':') ax.plot([2.35, 2.20], [48.85, 48.71], '.') ax.text(2.35, 48.85, "Paris") ax.text(2.20, 48.71, "Saclay", ha="right") ax.set_title('France'); .. image:: im_cartopy_5_0.png