On 20.01.2010 14:55, Scott Sinclair wrote:
>> 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 copies it has no effect
> on your figure.
> You'll need to use cb.ax.set_yticklabels() and pass a list of strings
> to use as tick labels. See
> http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html
> for an example.
>
> Cheers,
> Scott
Ok, something like

cl = cb.ax.get_yticklabels()
cl[0].set_text('bla')
cb.ax.set_yticklabels([elem.get_text() for elem in cl])

would work for the horizontal colorbars and y replaced by x. But

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.

Cheers

Mario

-- 
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: m...@meteo.uni-koeln.de
w: http://www.meteo.uni-koeln.de/~mmech/

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to