Plot only on continent in matplotlib

前端 未结 5 782
清歌不尽
清歌不尽 2020-11-27 07:13

I am drawing a map using basemap from matplotlib. The data are spreaded all over the world, but I just want to retain all the data on the continent and drop those on the oce

5条回答
  •  时光说笑
    2020-11-27 07:56

    There's method in matplotlib.basemap: is_land(xpt, ypt)

    It returns True if the given x,y point (in projection coordinates) is over land, False otherwise. The definition of land is based upon the GSHHS coastline polygons associated with the class instance. Points over lakes inside land regions are not counted as land points.

    For more information, see here.

提交回复
热议问题