Users of Matplotlib Basemap have long suffered a somewhat buggy API, that made cross-platform sharing of map plotting software a bit challenging at times. By 2017, Basemap deprecation was announced, with CartoPy designated as the Basemap replacement. Basemap is being minimally maintained for the sake of Python 2.7 users, and CartoPy is adding features to restore those not overlapping with Basemap. Instead of a massive multi-megabyte install, CartoPy downloads and caches shape files etc. as needed.
New users and new projects should be using PROJ.4 / GEOS-based CartoPy instead of Basemap.
shapely and other easily available / automatically & seamlessly installed
unlike Basemap which could be a fight to get installed.
conda install cartopy
zorder option of Matplotlib elements such as
zorder is higher priority (on top).
for an example of
Notice how the syntax is much more intuitive than Basemap.
import cartopy import cartopy.feature as cpf from matplotlib.pyplot import figure, show def main(): ax = figure().gca(projection=cartopy.crs.PlateCarree()) ax.add_feature(cpf.LAND) ax.add_feature(cpf.OCEAN) ax.add_feature(cpf.COASTLINE) ax.add_feature(cpf.BORDERS, linestyle=':') ax.add_feature(cpf.LAKES, alpha=0.5) ax.add_feature(cpf.RIVERS) ax.set_extent([-20, 60, -40, 40]) if __name__ == '__main__': main() show()