Menu

[r2728]: / trunk / toolkits / basemap / examples / setwh.py  Maximize  Restore  History

Download this file

62 lines (58 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# examples of using the 'width' and 'height' keywords
# to the Basemap constructor.
from matplotlib.toolkits.basemap import Basemap
from pylab import *
# setup projection centered on lon_0,lat_0
lat_0 = 40.
lon_0 = -100.
width = 6000000.
height = 2.*width/3.
delat = 25.
circles = arange(0.,90.+delat,delat).tolist()+\
arange(-delat,-90.-delat,-delat).tolist()
delon = 30.
meridians = arange(10.,360.,delon)
npanel = 0
# plots of the US.
projs = ['lcc','aeqd','aea','laea','eqdc','stere']
fig = figure(figsize=(8,12))
for proj in projs:
m = Basemap(width=width,height=height,
resolution='c',projection=proj,\
lat_0=lat_0,lon_0=lon_0)
npanel = npanel + 1
subplot(3,2,npanel)
# setup figure with same aspect ratio as map.
m.drawcoastlines()
m.drawcountries()
m.fillcontinents()
m.drawstates()
m.drawparallels(circles)
m.drawmeridians(meridians)
title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
show()
proj = 'omerc'
delat = 10.
circles = arange(0.,90.+delat,delat).tolist()+\
arange(-delat,-90.-delat,-delat).tolist()
delon = 10.
meridians = arange(10.,360.,delon)
lat_1 = 40; lat_2 = 55
lon_1 = -120; lon_2 = -140
lat_0 = 47.5 ; lon_0 = -130
fig = figure()
width = 1500000.
height = 2.5*width
m = Basemap(width=width,height=height,
resolution='l',projection=proj,\
lon_1=lon_1,lon_2=lon_2,\
lat_1=lat_1,lat_2=lat_2,\
lat_0=lat_0,lon_0=lon_0)
m.drawcoastlines(linewidth=0.5)
m.drawcountries(linewidth=0.5)
m.fillcontinents()
m.drawstates(linewidth=0.5)
m.drawparallels(circles)
m.drawmeridians(meridians)
title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
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.