Labels for ticks on the colorbar?

Hi,

Is is possible to customize the labels for the ticks of the colorbar? If so,
could someone please explain how this may be accomplished?

Thanks in advance,

John

The colorbar method returns a matplotlib.colorbar.Colorbar instance,
which contains a matplotlib.axes.Axes instance named "ax" (this is the
axes of the colorbar). I'm freestyling here, so there could be a
typo, but here is the idea:

cb = fig.colorbar(something)
for ticklabel in cb.ax.get_yticklabels():
   ticklabel.set_color('red') # the ticklabels are
matplotlib.text.Text instances

See http://matplotlib.sf.net/matplotlib.text.html and
http://matplotlib.sf.net/matplotlib.axes.html for details on the Text
and Axes methods that are available to you. You can set all kinds of
attributes on the Text instance (font style, fontsize, font weight,
color, etc...)

JDH

···

On Sat, Mar 1, 2008 at 8:34 PM, John R. Dowdle <jrdowdle@...287...> wrote:

Hi,

Is is possible to customize the labels for the ticks of the colorbar? If so,
could someone please explain how this may be accomplished?

Hi,

I need the same, and I did not understood the example.

I have an imageplot with imshow and in the colorbar in donot wish to have values but text strings.

can someone give me a small example to work on.

thanks,

···

On Sat, Mar 1, 2008 at 8:44 PM, John Hunter <jdh2358@…287…> wrote:

On Sat, Mar 1, 2008 at 8:34 PM, John R. Dowdle <jrdowdle@…287…> wrote:

Hi,

Is is possible to customize the labels for the ticks of the colorbar? If so,

could someone please explain how this may be accomplished?

The colorbar method returns a matplotlib.colorbar.Colorbar instance,

which contains a matplotlib.axes.Axes instance named “ax” (this is the

axes of the colorbar). I’m freestyling here, so there could be a

typo, but here is the idea:

cb = fig.colorbar(something)

for ticklabel in cb.ax.get_yticklabels():

ticklabel.set_color(‘red’) # the ticklabels are

matplotlib.text.Text instances

See http://matplotlib.sf.net/matplotlib.text.html and

http://matplotlib.sf.net/matplotlib.axes.html for details on the Text

and Axes methods that are available to you. You can set all kinds of

attributes on the Text instance (font style, fontsize, font weight,

color, etc…)

JDH


This SF.net email is sponsored by: Microsoft

Defy all challenges. Microsoft(R) Visual Studio 2008.

http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users