Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-21 Thread Eric Firing
Jae-Joon Lee wrote: On Wed, Jan 20, 2010 at 2:04 PM, Eric Firing efir...@hawaii.edu wrote: The reason for this fudge in contour is that contourf fills lower z = upper for each consecutive pair of contour levels. When the minimum value of z coincides with the lowest level, then regions with

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-21 Thread Jae-Joon Lee
On Thu, Jan 21, 2010 at 9:24 PM, Eric Firing efir...@hawaii.edu wrote: I changed my mind and decided you are correct in thinking the change should be made in contour.py.  I now make the bottom boundary adjustment at the last possible time, and in such a way that it does not change the  levels

[Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Mario Mech
Hi, it's probably a rather simple problem. Unfortunately I'm unable to solve it. The following code example describes my problem: 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 =

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Scott Sinclair
2010/1/20 Mario Mech m...@meteo.uni-koeln.de: cb = pyplot.colorbar(format=r%2.1f) for j in cb.ax.get_yticklabels():   j.set_text('bla') pyplot.show() Doesn't do anything. It looks like cb.ax.get_yticklabels() returns a list of copies of the Text objects. Since you are only changing the

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Mario Mech
On 20.01.2010 14:55, Scott Sinclair wrote: 2010/1/20 Mario Mechm...@meteo.uni-koeln.de: cb = pyplot.colorbar(format=r%2.1f) for j in cb.ax.get_yticklabels(): j.set_text('bla') pyplot.show() Doesn't do anything. It looks like cb.ax.get_yticklabels() returns a list of copies of the Text

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Scott Sinclair
2010/1/20 Mario Mech m...@meteo.uni-koeln.de: Ok, something like cl = cb.ax.get_yticklabels() cl[0].set_text('bla') cb.ax.set_yticklabels([elem.get_text() for elem in cl]) This works for me. But cl = cb.ax.get_yticklabels() results in a list of Text objects like Text(0,0,''). I have

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Mario Mech
This works for me. But cl = cb.ax.get_yticklabels() results in a list of Text objects like Text(0,0,''). I have no idea what's happening then. I see: for l in cl: print(l) Text(0,0,'bla') Text(0.17,0.17,'1.5') Text(0.33,0.33,'3.0') Text(0.5,0.5,'4.5')

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Sebastian Busch
Mario Mech wrote: ... #-- 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() for j in cb.ax.get_yticklabels(): print(j) # results in:

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Jae-Joon Lee
On Wed, Jan 20, 2010 at 9:17 AM, Mario Mech m...@meteo.uni-koeln.de wrote: cl = cb.ax.get_yticklabels() results in a list of Text objects like Text(0,0,''). So my problem is more to get the TickLabels for vertical colorbars. Can you elaborate why you need to do this? This is a general

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Jae-Joon Lee
On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech m...@meteo.uni-koeln.de wrote: the smallest value (0.0) is labeled with -0.0. I just want to get rid of the minus sign. This is because the actual value is -9.e-06 (this inherits from the levels of contour). While I think we're fixing a

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Eric Firing
Jae-Joon Lee wrote: On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech m...@meteo.uni-koeln.de wrote: the smallest value (0.0) is labeled with -0.0. I just want to get rid of the minus sign. This is because the actual value is -9.e-06 (this inherits from the levels of contour). While I

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Eric Firing
Jae-Joon Lee wrote: On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech m...@meteo.uni-koeln.de wrote: the smallest value (0.0) is labeled with -0.0. I just want to get rid of the minus sign. This is because the actual value is -9.e-06 (this inherits from the levels of contour). The

Re: [Matplotlib-users] modifying colorbar ticklabels

2010-01-20 Thread Jae-Joon Lee
On Wed, Jan 20, 2010 at 2:04 PM, Eric Firing efir...@hawaii.edu wrote: The reason for this fudge in contour is that contourf fills lower z = upper for each consecutive pair of contour levels. When the minimum value of z coincides with the lowest level, then regions with that minimum are left