Hi mpl'ers,
I have noticed that I keep setting the font size of the figure elements
(axes labels, tick labels, title) so often that it would deserve a
function, or better an Axes method to do the same. I am aware of the
matplotlibrc settings, but I need something to play with after a figure
is drawn. Below is my first attempt - is it the right way of doing
things? I misuse the fact that the figure title is the only Text child
in my figure.
r.
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, Text ):
child.set_size( titleMul * size )
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users