Menu

[r1143]: / trunk / toolkits / basemap / examples / nytolondon.py  Maximize  Restore  History

Download this file

32 lines (30 with data), 918 Bytes

 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
import matplotlib
from matplotlib.toolkits.basemap import Basemap
from pylab import *
m = Basemap(-90.,30.,30.,60.,\
resolution='c',area_thresh=10000.,projection='merc',\
lat_ts=20.)
xsize = rcParams['figure.figsize'][0]
fig=figure(figsize=(xsize,m.aspect*xsize))
fig.add_axes([0.1,0.1,0.8,0.8])
ax = gca() # get current axis instance
nylat = 40.78
nylon = -73.98
lonlat = 51.53
lonlon = 0.08
x,y = m.gcpoints(nylon,nylat,lonlon,lonlat,100)
ax.plot(x,y,linewidth=2)
ax.update_datalim(((m.llcrnrx, m.llcrnry),(m.urcrnrx,m.urcrnry)))
ax.set_xlim((m.llcrnrx, m.urcrnrx))
ax.set_ylim((m.llcrnry, m.urcrnry))
m.drawcoastlines(ax)
m.fillcontinents(ax)
# draw parallels
circles = [35,45,55]
m.drawparallels(ax,circles,labels=[1,1,0,1])
# draw meridians
delon = 30.
meridians = arange(-180,180,delon)
m.drawmeridians(ax,meridians,labels=[1,1,0,1])
title('Great Circle from New York to London')
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.