SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <js...@us...> - 2011年01月05日 16:29:59
Revision: 8890
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8890&view=rev
Author: jswhit
Date: 2011年01月05日 16:29:53 +0000 (2011年1月05日)
Log Message:
-----------
fix colorbar tick labels.
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/plotprecip.py
Modified: trunk/toolkits/basemap/examples/plotprecip.py
===================================================================
--- trunk/toolkits/basemap/examples/plotprecip.py	2011年01月05日 15:59:33 UTC (rev 8889)
+++ trunk/toolkits/basemap/examples/plotprecip.py	2011年01月05日 16:29:53 UTC (rev 8890)
@@ -57,7 +57,7 @@
 l, b, w, h = pos.bounds
 cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
 # draw colorbar.
-plt.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False) 
+cb = plt.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False) 
 plt.axes(ax) # make the original axes current again
 # plot title
 plt.title(plottitle+'- contourf',fontsize=10)
@@ -85,11 +85,11 @@
 # using im2, not im (hack to prevent colors from being
 # too compressed at the low end on the colorbar - results
 # from highly nonuniform colormap)
-plt.colorbar(im2, cax, format='%d') # draw colorbar
+cb = plt.colorbar(im2, cax, format='%d') # draw colorbar
 plt.axes(ax) # make the original axes current again
 # reset colorbar tick labels (hack to get
-cax.set_yticks(np.linspace(0,1,len(clevs)))
-cax.set_yticklabels(['%g' % clev for clev in clevs])
+cb.set_ticks(np.linspace(clevs[0],clevs[-1],len(clevs)))
+cb.set_ticklabels(['%g' % clev for clev in clevs])
 # plot title
 plt.title(plottitle+' - imshow',fontsize=10)
 plt.show() # display onscreen.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /