下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
下载对应的安装包,然后在下载的文件夹下使用命令行安装:
pip install pyproj-1.9.5.1-cp36-cp36m-win_amd64.whl
pip install basemap-1.1.0-cp36-cp36m-win_amd64.whl
实现以上效果:
import time
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
t_color = ['g', 'b', 'r', 'c', 'k', 'm', 'y', 'orange', 'peru', 'navy', 'thistle']
# 显示单组坐标
def show_map(lon, lat, color='m'):
plt.figure(figsize=(25, 10))
map = Basemap(llcrnrlon=None, llcrnrlat=None, urcrnrlon=None, urcrnrlat=None, )
map.etopo()
map.drawcoastlines(linewidth=0.5)
map.drawrivers()
map.drawcountries()
map.drawstates()
map.drawmapboundary()
lon, lat = map(lon, lat)
plt.scatter(lon, lat, marker='+', color=color, linewidth=1)
file_name = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
plt.savefig(file_name + '.png')
plt.clf()
num = 3000
x = 360*np.random.randn(num)
y = 90* np.sin(0.05 * x)
show_map(x,y)