Revision: 6980
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6980&view=rev
Author: jswhit
Date: 2009-03-16 15:59:45 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
add some comments.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plotmap_shaded.py
Modified: trunk/toolkits/basemap/examples/plotmap_shaded.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-14 23:44:09 UTC
(rev 6979)
+++ trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-16 15:59:45 UTC
(rev 6980)
@@ -26,12 +26,15 @@
# transform to nx x ny regularly spaced native projection grid
nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
topodat,x,y = m.transform_scalar(topoin,lons,lats,nx,ny,returnxy=True)
+# create light source object.
ls = lightsource(azdeg = 90, altdeg = 20)
-print topodat.shape
+# convert data to rgb array including shading from light source.
+# (must specify color map)
rgb = ls.shade(topodat, plt.cm.jet)
# create the figure.
fig=plt.figure(figsize=(8,8))
-# plot image over map with imshow.
+# plot image over map with imshow (pass rgb values
+# that include light shading).
im = m.imshow(rgb)
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -44,5 +47,4 @@
m.drawmeridians(meridians,labels=[1,1,0,1])
# set title.
plt.title('ETOPO Shaded Relief - Lambert Conformal Conic')
-#plt.savefig('plotmap.pdf')
plt.show()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins