Menu

[r4657]: / trunk / py4science / examples / basemap1.py  Maximize  Restore  History

Download this file

23 lines (22 with data), 858 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap
# create map by specifying lat/lon values at corners.
resolution = 'l'; projection = 'lcc'
lat_0 = 60; lon_0 = -50
llcrnrlat, llcrnrlon = 8, -92
urcrnrlat, urcrnrlon = 39, 63
m = Basemap(lat_0=lat_0,lon_0=lon_0,\
llcrnrlat=llcrnrlat,llcrnrlon=llcrnrlon,\
urcrnrlat=urcrnrlat,urcrnrlon=urcrnrlon,\
resolution=resolution,projection=projection)
# draw coastlines. Make liness a little thinner than default.
m.drawcoastlines(linewidth=0.5)
# background fill color will show ocean areas.
m.drawmapboundary(fill_color='aqua')
# fill continents, lakes within continents.
m.fillcontinents(color='coral',lake_color='aqua')
# draw states and countries.
m.drawcountries()
m.drawstates()
pylab.title('map region specified using corner lat/lon values')
pylab.show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.