set font properties for colorbar

Hello,

I see that for a legend you can do the following:

ax = plt.scatter(x,y,label='test data')
p_leg = mpl.font_manager.FontProperties(size='8')
ax.legend(prop=p_leg)

But, how do you do set font properties for the colorbar tick labels?

Thanks!

When cax is an axes instance of the colorbar, you may use

cax.tick_params(labelsize=8)

If you want to directly set the FontProperties, you need to iterate
over the ticks (it seems that tick_params does not support this).

for tick in cax.yaxis.majorTicks:
    tick.label2.set_fontproperties(fp)

Note that the details depends on the current colorbar setup
(orientation etc.). The bottom line is that cax can be treated as a
normal axes.

-JJ

ยทยทยท

On Fri, Nov 19, 2010 at 9:30 AM, John <washakie@...287...> wrote:

Hello,

I see that for a legend you can do the following:

ax = plt.scatter(x,y,label='test data')
p_leg = mpl.font_manager.FontProperties(size='8')
ax.legend(prop=p_leg)

But, how do you do set font properties for the colorbar tick labels?

Thanks!