On Fri, Oct 10, 2008 at 4:17 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to change the font size of x ticks labels.
> The FAQ entry is only for pylab:
> http://matplotlib.sourceforge.net/faq.html#TEXTOVERLAP
>
> I found this solution:
>
>    for tick in ax.xaxis.get_major_ticks():
>        tick.label1.set_fontsize(7.5)
>  (http://cfa-www.harvard.edu/~jbattat/computer/python/pylab/)
>
> What is the prefered way? Maybe without a loop...

There is no preferred way -- the loop is the object oriented pythonic
matplotlib API, the set call is the matlab-like procedural interface.
Both are and will continue to be supported.  Note that the FAQ is out
of date since the set function (a matlab name)  is now called setp to
avoid clashing with the python built-in set

Personally, I use

  for label in ax.get_xticklabels() + ax.get_yticklabels():
      label.set_fontsize(12)

You can also set the defaults with your rc settings

  import matplotlib
  matplotlib.rc('xtick', labelsize=12)
  matplotlib.rc('ytick', labelsize=12)

which will affect all subsequent figures.

JDH

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to