|
From: Mario M. <me...@me...> - 2010-01-20 17:12:22
|
> Can you elaborate why you need to do this? As you can see in my example: #------ import numpy as np from matplotlib import pyplot,mpl x = np.arange(10) y = np.arange(25) z = np.floor(10*np.random.random((25,10))) pyplot.contourf(x,y,z) cb = pyplot.colorbar() pyplot.show() #------ the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign. Cheers Mario > This is a general behavior of Axes in matplotlib (i.e., not colorbar > specific). There are things that are evaluated later when the figure > gets drawn. > You may use iter_ticks method if it fits your need. > > for j, p, l in cb.ax.yaxis.iter_ticks(): > print l > > To change the ticklabels of colorbar, they need to be set when the > colorbar is created, as Scott suggested. This is a limitation of the > current colobar implementation. Changing ticklabels (or locations) > after colorbar is created is quite tricky. > > Regards, > > -JJ -- Dr. Mario Mech Institute for Geophysics and Meteorology University of Cologne Zuelpicher Str. 49a 50674 Cologne Germany t: +49 (0)221 - 470 - 1776 f: +49 (0)221 - 470 - 5198 e: me...@me... w: http://www.meteo.uni-koeln.de/~mmech/ |