|
| 1 | +import cartopy.crs as ccrs |
| 2 | +import matplotlib.pyplot as plt |
| 3 | + |
| 4 | +REGIONS = { |
| 5 | + "Irminger Sea": {"label": "1", "coords": (57.25, -33.0)}, |
| 6 | + "California Current": {"label": "2", "coords": (35, -132)}, |
| 7 | + "Gulf Stream and Deep Western Boundary Current": { |
| 8 | + "label": "3", |
| 9 | + "coords": (32.0, -72.0), |
| 10 | + }, |
| 11 | + "Japan current": {"label": "4", "coords": (31.7, 141)}, |
| 12 | + "Atlantic Meridional Overturning Circulation (AMOC)": { |
| 13 | + "label": "5", |
| 14 | + "coords": (26, -47), |
| 15 | + }, |
| 16 | + "El Niño Southern Oscillation (ENSO)": {"label": "6", "coords": (-5.0, -91.5)}, |
| 17 | + "North Brazil current": {"label": "7", "coords": (2.0, -43.0)}, |
| 18 | + "Somali current": {"label": "8", "coords": (6.0, 53.0)}, |
| 19 | + "East Australian Current": {"label": "9", "coords": (-28.0, 156)}, |
| 20 | + "Drake passage": {"label": "10", "coords": (-58.0, -57.0)}, |
| 21 | +} |
| 22 | + |
| 23 | + |
| 24 | +def _global_plot(width=10, height=5, regions=None) -> None: |
| 25 | + fig = plt.figure(figsize=(width, height), dpi=300) |
| 26 | + ax = fig.add_subplot(1, 1, 1, projection=ccrs.Robinson()) |
| 27 | + |
| 28 | + ax.set_global() |
| 29 | + |
| 30 | + if regions: |
| 31 | + for _, info in regions.items(): |
| 32 | + ax.text( |
| 33 | + info["coords"][1], |
| 34 | + info["coords"][0], |
| 35 | + info["label"], |
| 36 | + transform=ccrs.PlateCarree(), |
| 37 | + fontsize=8, |
| 38 | + fontweight="bold", |
| 39 | + color="red", |
| 40 | + ) |
| 41 | + |
| 42 | + ax.stock_img() |
| 43 | + ax.coastlines(linewidth=0.5) |
0 commit comments