Python Matplotlib绘图之BaseMap
1. Python安装库,需要安装proj, geos(brew install proj, brew install geos)以及basemap,其中basemap无法用pip install安装,需要下载解压后,进入目录输入python3 setup.py install进行安装。
2. 示例代码,参考https://matplotlib.org/basemap/users/examples.html
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
# set up orthographic map projection with
# perspective of satellite looking down at 50N, 100W.
# use low resolution coastlines.
map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l')
# draw coastlines, country boundaries, fill continents.
map.drawcoastlines(linewidth=0.25)
map.drawcountries