Does anyone know any easy way to set the 'global' font sizes for eg. tick mark labels, titles, xlabels, ylabels for matplotlib? I would rather not use the matplotlibrc file since I want the code to be platform independent. Can I set something in my code that will then affect all subsequent figures? Dave
"Howey," == Howey, David A <d.howey@imperial.ac.uk> writes:
David> Does anyone know any easy way to set the 'global' font David> sizes for eg. tick mark labels, titles, xlabels, ylabels David> for matplotlib? I would rather not use the matplotlibrc David> file since I want the code to be platform independent. Can David> I set something in my code that will then affect all David> subsequent figures? This question is more appropriate on matplotlib-users (attempting to set followups). You can subscribe at http://lists.sourceforge.net/mailman/listinfo/matplotlib-users . You can also set the rc params from within a script, and this will affect all subsequent figures. There are two ways to do it. * Use rcParams; this is a dictionary where the keys are the same as in the rc file from matplotlib import rcParams rcParams.update( { 'font.family' : 'serif', 'font.style' : 'normal', 'font.variant' : 'normal', 'font.weight' : 'bold', 'font.stretch' : 'normal', 'font.size' : 'large', }) from pylab import * plot([1,2,3]) show() or use the "rc" command, which may be syntactically nicer but is equivalent; see http://matplotlib.sourceforge.net/matplotlib.pylab.html#-rc from matplotlib import rc rc('font', family='serif', style='normal', variant='normal', weight='bold', stretch='normal', size='large') from pylab import * plot([1,2,3]) show() Note that changing these in the rc file is almost as portable. matplotlib respects per directory rc files, so you can make your customizations in the rc file and distribute it with your script/application and this will override the user's default configuration. JDH
participants (2)
-
Howey, David A -
John Hunter