Graph Machine Learning
AnemoI
English
File size: 956 Bytes
9cacbc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy

def map_scatter(lats, lons, data, proj=ccrs.PlateCarree(), mask_ocean=False, region=None, axes=None,plot_title=None,cmap_label=None,**kwargs):
    if axes is None:
        fig, axes = plt.subplots(subplot_kw={'projection': proj}, figsize=(16,6))
    axes.coastlines()
    axes.gridlines()
    sc = axes.scatter(
        x=lons,
        y=lats,
        c=data,
        transform=ccrs.PlateCarree(),
        s=1,
        **kwargs,
    )
    plt.colorbar(sc,label=cmap_label)
    plt.title(plot_title)
    # Add title and labels

    if mask_ocean:
        axes.add_feature(cartopy.feature.OCEAN, zorder=1, color="w")
    gl = axes.gridlines(draw_labels=True, alpha=.3, color='grey', 
                      linewidth=0.5,linestyle ='-', 
                      x_inline= False, y_inline=False)
    gl.n_steps = 100
    gl.top_labels = False
    gl.right_labels = False
    return None