How to change axis fontsize

Hi everyone, Is there an equivalent to the Matlab

    > set(gca,'FontSize',12)?

There is no direct way to set the font size for the current axes.
Actually, I've never quite understood what that call does in matlab.
If I recall correctly, it does not set *all* the axes text instances
to that size; eg, I don't think it affects the tick labels.
Admittedly it's been a long time, mainly because I don't use matlab
much anymore :-). If you know what this command does in matlab and
can explain it to me, I'm all ears!

However, in matplotlib, the font sizes of all the figure elements can
be controlled. The best way to do this depends on what you are trying
to do.

Any text command, eg text, xlabel, ylabel, title, accepts the fontsize
kwarg, so you can specify the fontsize with, for example,

  xlabel('my label', fontsize=14)

If you want more global control, at any point in a script's execution,
you can set the default font properties; see
examples/ in the matplotlib src distribution.

If you want to change the default fontsize for all figures created in
a given script/interactive session, you can set the rcParams font.size
attribute on a per script bases, as described in

Finally, if you want to change the default font size globally for all
figures in all scripts, you can edit your .matplotlibrc file, as
described in

Hope this helps!

John, thanks for the information, I will study these options.

In Matlab, set(gca,'FontSize',12) will have at least two effects. The fontsize of the tickmark labels will be set accordingly, and the set of tickmarks will be reasonably adjusted to prevent overlapping text. If a legend exists, the fonts there will also be changed. Axes labels are not affected. For example,

axes % returns empty plot, x and yrange=[0 1]
set(gca,'FontSize',12) % tickmarks=[0:0.2:1]
set(gca,'FontSize',8) % tickmarks=[0:0.1:1]
set(gca,'FontSize',20) % tickmarks=[0:0.5:1]

The desired size of the tickmarks depends on whether I am creating a plot for publication, or for a talk. I find that I tweak this quite a bit in Matlab, looking for the most appealing result (I started in graphic design, 10 years ago).