Revision: 8890 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8890&view=rev Author: jswhit Date: 2011-01-05 16:29:53 +0000 (Wed, 05 Jan 2011)
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. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins