Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- from matplotlib.patches import Polygon
- from mpl_toolkits.basemap import Basemap
- # Setup map projection.
- ulat, llat, ulon, llon = 07., -35., -32., -77.
- fig = plt.figure()
- map = Basemap(projection='merc', llcrnrlat=llat,
- urcrnrlat=ulat,
- llcrnrlon=llon,
- urcrnrlon=ulon,
- resolution='i')
- shp = map.readshapefile('/usr/share/basemap/brazil', 'states', drawbounds=True)
- map.fillcontinents()
- map.drawparallels([-34, 05], linewidth=0, labels=[1,0,0,1])
- map.drawmeridians([llon, ulon], linewidth=0, labels=[1,0,0,1])
- ax = plt.gca()
- for nshape,seg in enumerate(map.states):
- poly = Polygon(seg,facecolor='.75',edgecolor='k')
- ax.add_patch(poly)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement