Creating default value sets for Matplotlib

I often make stories for my own research, and all the default settings are great, but often you have to switch to creating stories for talks / presentations; I manually set all font sizes a bit more for readability:

plot(xdata, ydata)
xlabel("x-axis data", fontsize=20)
ax = gca()
for labeltick in ax.xaxis.get_majorticklabels() + ax.yaxis.get_majorticklabels():
        labeltick.set_fontsize(15)

etc.

Thanks to the documentation and questions like this , I know how to manage the default build options when starting matplotlib. I was thinking of writing something very fast (mpl_defaults.py):

import matplotlib as mpl
def plot_for_talks():
    mpl.rcParams['font.size'] = 20
    mpl.rcParams['figure.subplot.left'] = .2
    mpl.rcParams['figure.subplot.right'] = .8
    mpl.rcParams['figure.subplot.bottom'] = .2
    mpl.rcParams['figure.subplot.top'] = .8

Then my build code can only include

import mpl_defaults
plot_for_talks()

My question is: is there a more suitable way to do this? Maybe something has already been built?

+5
2

:

import matplotlib as mpl    
mpl.rc('figure.subplot', left=.2, right=.8, bottom=.2, top=.8)

"site-packages/matplotlib/mpl-data/matplotlibrc", 5.1.

mpl.matplotlib_fname(), rc , , .

+4

, matplotlibrc , matplotlib , .

+4

All Articles