Advertisement
Guest User

Untitled

a guest
Sep 29th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. from matplotlib.patches import Polygon
  3. from mpl_toolkits.basemap import Basemap
  4.  
  5. # Setup map projection.
  6. ulat, llat, ulon, llon =  07., -35., -32., -77.
  7.  
  8. fig = plt.figure()
  9. map = Basemap(projection='merc', llcrnrlat=llat,
  10.                                  urcrnrlat=ulat,
  11.                                  llcrnrlon=llon,
  12.                                  urcrnrlon=ulon,
  13.                                  resolution='i')
  14.  
  15. shp = map.readshapefile('/usr/share/basemap/brazil', 'states', drawbounds=True)
  16. map.fillcontinents()
  17.  
  18. map.drawparallels([-34, 05], linewidth=0, labels=[1,0,0,1])
  19. map.drawmeridians([llon, ulon], linewidth=0, labels=[1,0,0,1])
  20.  
  21. ax = plt.gca()
  22. for nshape,seg in enumerate(map.states):
  23.       poly = Polygon(seg,facecolor='.75',edgecolor='k')
  24.       ax.add_patch(poly)
  25.  
  26. plt.show()
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement