Robert Cimrman wrote:
[...]
> 
> Great! I used to write many such functions for setting font sizes of all
> elements in a figure. But speaking about the font sizes, one usually 
> wants the title to be in larger font then the axis labels etc. How could 
> something like this be implemented within your general findobj()?
> 
> Just for the reference, this is how I did it:
> def setAxesFontSize( ax, size, titleMul = 1.2, labelMul = 1.0 ):
>      """size    : tick label size,
>         titleMul: title label size multiplicator,
>         labelMul: x, y axis label size multiplicator"""
>      labels = ax.get_xticklabels() + ax.get_yticklabels()
>      for label in labels:
>          label.set_size( size )
> 
>      labels = [ax.get_xaxis().get_label(), ax.get_yaxis().get_label()]
>      for label in labels:
>          label.set_size( labelMul * size )
> 
>      for child in ax.get_children():
>          if isinstance( child, pylab.Text ):
>              child.set_size( titleMul * size )
> 
> Maybe it could be implemented in the sense of:
> 
> def myfontsizes( x ):
>      """Depending on class of x, return also suggested value of the font 
> 
>         size."""
> 
> for o, size in fig.findobj( myfontsizes, suggest_value = True ):
>      o.set_size( size )
> 
> # Default for suggest_value is False...
> for o in fig.findobj(text.Text):
>      o.set_fontstyle('italic')
> 
> What do you think?

I'm not sure if this is addressing your situation, but the simplest way 
to adjust all font sizes is to use the rcParams dictionary, either 
directly or via the matplotlibrc file.  If the default font sizes for 
various items are specified using "medium", "large", etc, instead of 
with numerical values in points, then everything can be scaled by 
changing the single value, font.size, which is the point size 
corresponding to "medium".

Eric

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to