正文
python3 安装 basemap 包(windows10)
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
下载 pyproj 和 basemap 的安装包
basemap 是具有专业标准的地图绘制工具,可以与 matplotlib 的一般绘图功能结合,在地图上绘制数据。
basemap 文档:https://matplotlib.org/basemap/api/basemap_api.html
下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
找到 pyproj 和 basemap 的安装包
安装 pyproj 和 basemap
下载完成后,打开 cmd (有可能需要管理员权限)进行安装
pip install pyproj-1.9.6-cp36-cp36m-win_amd64.whl
pip install basemap-1.2.0-cp36-cp36m-win_amd64.whl
安装完成后,使用 basemapfrom mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as npmap = Basemap(projection='merc', resolution='h',area_thresh=0.1, llcrnrlon=-126.619875, llcrnrlat=31.354158, urcrnrlon=-59.647219, urcrnrlat=47.517613)
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color='coral', lake_color='aqua')
map.drawmapboundary(fill_color='aqua')
map.drawmeridians(np.arange(0, 360, 30))
map.drawparallels(np.arange(-90, 90, 30))
plt.show()
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as npmap = Basemap(projection='merc', resolution='h',area_thresh=0.1, llcrnrlon=-126.619875, llcrnrlat=31.354158, urcrnrlon=-59.647219, urcrnrlat=47.517613)
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color='coral', lake_color='aqua')
map.drawmapboundary(fill_color='aqua')
map.drawmeridians(np.arange(0, 360, 30))
map.drawparallels(np.arange(-90, 90, 30))
plt.show()