colorbar tick label fontproperties

Could someone please explain how to change the font properties for a colorbar
tick label, the following causes no error, but it does NOT work:

    ## CREATE COLORBAR
    ## make a copy of the image object
    im2 = copy.copy(im)
    im2.set_cmap(colmap)
    ## create new axis for colorbar.
    cax = plt.axes([l+w+0.03, b, 0.025, h-0.035])
    cb = plt.colorbar(im2, cax)#, format='%3.2g') # draw colorbar
    ## set colorbar label and ticks
    p_cax = mpl.font_manager.FontProperties(size='6')
    clabels = clevs[::10] ##clevs, by 10 steps
    clabels.append(clevs[-1]) ## add the last label
    cb.ax.set_yticks(np.linspace(0,1,len(clabels)))
    cb.ax.set_yticklabels(['%3.2g' % cl for cl in clabels],
                        fontproperties=p_cax)
    cax.set_title('sensitivity\n(%s)' % units,
                      fontproperties=p_cax)

NOTE: It does set the title properties correctly.

···

--
View this message in context: http://www.nabble.com/colorbar-tick-label-fontproperties-tp25530779p25530779.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

John,

The following code works for me (Python 2.5.4, Matplotlib 0.99):

# create and format the colorbar
cbar = pl.colorbar(G, ticks=range(g1,g2+1))
cbar.ax.set_ylabel('Gradient (%)', fontsize=10)
cl = pl.getp(cbar.ax, 'ymajorticklabels')
pl.setp(cl, fontsize=10)

-Paul M. Hobson

···

-----Original Message-----
From: John [H2O] [mailto:washakie@…287…]
Sent: Tuesday, September 22, 2009 8:03 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] colorbar tick label fontproperties

Could someone please explain how to change the font properties for a
colorbar
tick label, the following causes no error, but it does NOT work:

    ## CREATE COLORBAR
    ## make a copy of the image object
    im2 = copy.copy(im)
    im2.set_cmap(colmap)
    ## create new axis for colorbar.
    cax = plt.axes([l+w+0.03, b, 0.025, h-0.035])
    cb = plt.colorbar(im2, cax)#, format='%3.2g') # draw colorbar
    ## set colorbar label and ticks
    p_cax = mpl.font_manager.FontProperties(size='6')
    clabels = clevs[::10] ##clevs, by 10 steps
    clabels.append(clevs[-1]) ## add the last label
    cb.ax.set_yticks(np.linspace(0,1,len(clabels)))
    cb.ax.set_yticklabels(['%3.2g' % cl for cl in clabels],
                        fontproperties=p_cax)
    cax.set_title('sensitivity\n(%s)' % units,
                      fontproperties=p_cax)

NOTE: It does set the title properties correctly.
--
View this message in context: http://www.nabble.com/colorbar-tick-
label-fontproperties-tp25530779p25530779.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

----------------------------------------------------------------------
--------
Come build with us! The BlackBerry® 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/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options