From 6610dd0397a5b482e83ffb1e168c50be887038b5 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 22 Jun 2021 12:46:30 +0200 Subject: [PATCH] Replace basemap by cartopy --- Inst_eddies/Documentation_texfol/Graphiques/regions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Inst_eddies/Documentation_texfol/Graphiques/regions.py b/Inst_eddies/Documentation_texfol/Graphiques/regions.py index a128e430..c4bc2db9 100755 --- a/Inst_eddies/Documentation_texfol/Graphiques/regions.py +++ b/Inst_eddies/Documentation_texfol/Graphiques/regions.py @@ -1,17 +1,14 @@ #!/usr/bin/env python3 import netCDF4 -from mpl_toolkits import basemap +import cartopy.crs as ccrs import jumble from matplotlib import pyplot as plt import glob import itertools -m = basemap.Basemap(llcrnrlon=-30, llcrnrlat=-90, urcrnrlon=60, urcrnrlat = 0) plt.figure() -m.drawcoastlines() -m.drawmeridians(range(0,361, 15), labels = [0, 0, 0, 1]) -m.drawparallels(range(-90,91, 15), labels = [1, 0, 0, 0]) +ax = plt.axes(projection=ccrs.PlateCarree()) colors = itertools.cycle(['blue', 'orange', 'green', 'red', 'purple', 'brown', 'pink', 'gray', 'olive', 'cyan']) @@ -27,6 +24,9 @@ for filename in glob.glob("h_region_*.nc") + ["h_outermost.nc"]: jumble.draw_bbox(f[lon][0], f[lon][-1], f[lat][0], f[lat][-1], colors = next(colors), label = filename) +ax.set_extent((-30, 60, -90, 0), ccrs.PlateCarree()) +ax.coastlines() +ax.gridlines(draw_labels = True) plt.legend(loc = "lower left", bbox_to_anchor = (1, 0.5)) plt.subplots_adjust(right = 0.7) plt.savefig("regions.pdf") -- GitLab