#!/usr/bin/env python 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. # don't plot features that are smaller than 1000 square km. map = Basemap(projection='ortho',lat_0=50,lon_0=-100, resolution='l',area_thresh=1000.) # draw coastlines, country boundaries, fill continents. map.bluemarble() #map.drawcoastlines() #map.drawcountries() #map.fillcontinents(color='coral') # draw the edge of the map projection region (the projection limb) map.drawmapboundary() # draw lat/lon grid lines every 30 degrees. map.drawmeridians(np.arange(0,360,30)) map.drawparallels(np.arange(-90,90,30)) # lat/lon coordinates of five cities. lats=[40.02,32.73,38.55,48.25,17.29] lons=[-105.16,-117.16,-77.00,-114.21,-88.10] cities=['Boulder, CO','San Diego, CA', 'Washington, DC','Whitefish, MT','Belize City, Belize'] # compute the native map projection coordinates for cities. x,y = map(lons,lats) # plot filled circles at the locations of the cities. map.plot(x,y,'bo') # plot the names of those five cities. for name,xpt,ypt in zip(cities,x,y): plt.text(xpt+50000,ypt+50000,name) plt.show()