Revision: 6087
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6087&view=rev
Author: jswhit
Date: 2008-09-12 02:35:02 +0000 (Fri, 12 Sep 2008)
Log Message:
-----------
add colorbar
Modified Paths:
--------------
trunk/toolkits/basemap/examples/randompoints.py
Modified: trunk/toolkits/basemap/examples/randompoints.py
===================================================================
--- trunk/toolkits/basemap/examples/randompoints.py 2008-09-11 20:28:11 UTC
(rev 6086)
+++ trunk/toolkits/basemap/examples/randompoints.py 2008-09-12 02:35:02 UTC
(rev 6087)
@@ -28,16 +28,18 @@
# draw colored markers.
# use zorder=10 to make sure markers are drawn last.
# (otherwise they are covered up when continents are filled)
-#m.scatter(x,y,25,z,cmap=plt.cm.jet,marker='o',edgecolors='none',zorder=10)
+m.scatter(x,y,25,z,cmap=plt.cm.jet,marker='o',edgecolors='none',zorder=10)
+# plot colorbar for markers.
+plt.colorbar()
# create a list of strings containing z values
# or, plot actual numbers as color-coded text strings.
-zn = [ '%2i' % zz for zz in z ]
-# plot numbers on map, colored by value.
-for numstr,zval,xpt,ypt in zip(zn,z,x,y):
- # only plot values inside map region.
- if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt < m.ymax:
- hexcolor = rgb2hex(plt.cm.jet(zval/100.)[:3])
- plt.text(xpt,ypt,numstr,fontsize=9,weight='bold',color=hexcolor)
+#zn = [ '%2i' % zz for zz in z ]
+## plot numbers on map, colored by value.
+#for numstr,zval,xpt,ypt in zip(zn,z,x,y):
+# # only plot values inside map region.
+# if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt < m.ymax:
+# hexcolor = rgb2hex(plt.cm.jet(zval/100.)[:3])
+# plt.text(xpt,ypt,numstr,fontsize=9,weight='bold',color=hexcolor)
# draw coasts and fill continents/lakes.
m.drawcoastlines(linewidth=0.5)
m.fillcontinents(color='coral',lake_color='aqua')
@@ -50,6 +52,6 @@
m.drawparallels(circles)
delon = 45.
meridians = np.arange(0,360,delon)
-m.drawmeridians(meridians,labels=[1,1,1,1])
-plt.title('Random Points',y=1.075)
+m.drawmeridians(meridians,labels=[1,0,1,1])
+plt.title('Random Points',y=1.05)
plt.show()
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins