最简单的方式是通过 conda 来进行安装:
conda install basemap
也可以下载下来自己编译。
绘制一幅世界地图:
In [2]:
%matplotlib inline
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# lon_0 is central longitude of projection.
# resolution = 'c' means use crude resolution coastlines.
f = plt.figure(figsize=(16,9))
m = Basemap(projection='robin',lon_0=0,resolution='c')
m.shadedrelief(scale=0.2)
plt.title("Robinson Projection")
plt.show()