Revision: 4973
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4973&view=rev
Author: jswhit
Date: 2008-02-15 08:01:05 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
added blue marble background
Modified Paths:
--------------
trunk/toolkits/basemap/examples/wiki_example.py
Modified: trunk/toolkits/basemap/examples/wiki_example.py
===================================================================
--- trunk/toolkits/basemap/examples/wiki_example.py 2008-02-15 15:47:46 UTC
(rev 4972)
+++ trunk/toolkits/basemap/examples/wiki_example.py 2008-02-15 16:01:05 UTC
(rev 4973)
@@ -35,6 +35,39 @@
x, y = map(lons*180./p.pi, lats*180./p.pi)
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
+
+# as above, but use blue marble image as map background.
+fig = p.figure()
+map = Basemap(projection='ortho',lat_0=50,lon_0=-100,resolution='l')
+map.drawmapboundary()
+map.drawmeridians(p.arange(0,360,30))
+map.drawparallels(p.arange(-90,90,30))
+# lat/lon coordinates of five cities.
+lats=[40.02,32.73,38.55,48.25,17.29]
+lons=[-105.16,-117.16,-77.00,-114.21,-88.10]
+cities=['Boulder, CO','San Diego, CA',
+ 'Washington, DC','Whitefish, MT','Belize City, Belize']
+# compute the native map projection coordinates for cities.
+x,y = map(lons,lats)
+# plot filled circles at the locations of the cities.
+map.plot(x,y,'yo')
+# plot the names of those five cities.
+for name,xpt,ypt in zip(cities,x,y):
+ p.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
+# make up some data on a regular lat/lon grid.
+nlats = 73; nlons = 145; delta = 2.*p.pi/(nlons-1)
+lats = (0.5*p.pi-delta*p.indices((nlats,nlons))[0,:,:])
+lons = (delta*p.indices((nlats,nlons))[1,:,:])
+wave = 0.75*(p.sin(2.*lats)**8*p.cos(4.*lons))
+mean = 0.5*p.cos(2.*lats)*((p.sin(2.*lats))**2 + 2.)
+# compute native map projection coordinates of lat/lon grid.
+x, y = map(lons*180./p.pi, lats*180./p.pi)
+# contour data over the map.
+cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
+# draw blue marble image in background.
+map.bluemarble()
p.show()
+
#p.savefig('wiki_example.ps')
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins