Colorbar with labels on top

Hi,

I'm trying to plot a horizontal colorbar with labels on top. I can use

axcbar = fig.add_axes([0.2, 0.85, 0.6, 0.03])
axcbar.xaxis.set_ticks_position('top')
cbar = fig.colorbar(s, cax=axcbar, orientation='horizontal')

but then I lose the ticks on the bottom of the colorbar. However, setting

axcbar.xaxis.set_ticks_position('both')

causes the labels to be on the bottom. Is there a way to have labels on the top while keeping ticks on both the top and bottom?

Thanks,

Thomas

The api related to ticks and ticklabels is a bit confusing, at least
for me. So, often, it seems best to directly change the tick
properties.

for t in axcbar.xaxis.get_major_ticks():
    t.tick1On = True
    t.tick2On = True
    t.label1On = False
    t.label2On = True

-JJ

ยทยทยท

On Wed, Oct 21, 2009 at 11:24 AM, Thomas Robitaille <thomas.robitaille@...287...> wrote:

Hi,

I'm trying to plot a horizontal colorbar with labels on top. I can use

axcbar = fig.add_axes([0.2, 0.85, 0.6, 0.03])
axcbar.xaxis.set_ticks_position('top')
cbar = fig.colorbar(s, cax=axcbar, orientation='horizontal')

but then I lose the ticks on the bottom of the colorbar. However,
setting

axcbar.xaxis.set_ticks_position('both')

causes the labels to be on the bottom. Is there a way to have labels
on the top while keeping ticks on both the top and bottom?

Thanks,

Thomas

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options