python basemap 在地图标点

来源:互联网 发布:全国复杂网络大会 编辑:程序博客网 时间:2024/05/16 12:27
接上一篇的代码原网址:http://matplotlib.org/basemap/users/mapcoords.html#converting-to-and-from-map-projection-coordinates# plot blue dot on Boulder, colorado and label it as such.lon, lat = -104.237, 40.125 # Location of Boulder# convert to map projection coords.# Note that lon,lat can be scalars, lists or numpy arrays.xpt,ypt = m(lon,lat)# convert back to lat/lonlonpt, latpt = m(xpt,ypt,inverse=True)m.plot(xpt,ypt,'bo')  # plot a blue dot there# put some text next to the dot, offset a little bit# (the offset is in map projection coordinates)plt.text(xpt+100000,ypt+100000,'Boulder (%5.1fW,%3.1fN)' % (lonpt,latpt))plt.show()../_images/plotboulder.png
原创粉丝点击