You can save the rcParams
you want, before changing the style with seaborn (note that seaborn no longer changes the rcParams
upon import):
import matplotlib as mpl
my_params = mpl.rcParams
# apply some change to the rcparams here
mpl.rcParams.update(my_params)
Note that both these
mpl.rcParams.update(mpl.rcParamsOrig)
mpl.rcParams.update(mpl.rcParamsDefault)
restores almost all rcParams
to their default value. The few that will be different can easily be viewed by (I ran this in a Jupyter Notebook):
# Differences between current params and `Default`
for key in mpl.rcParamsDefault:
if not mpl.rcParamsDefault[key] == mpl.rcParams[key]:
print(key, mpl.rcParamsDefault[key], mpl.rcParams[key])
## backend agg module://ipykernel.pylab.backend_inline
## figure.dpi 100.0 72.0
## figure.edgecolor w (1, 1, 1, 0)
## figure.facecolor w (1, 1, 1, 0)
## figure.figsize [6.4, 4.8] [6.0, 4.0]
## figure.subplot.bottom 0.11 0.125
and
# Differences between `Default` and `Orig`
for key in mpl.rcParamsDefault:
if not mpl.rcParamsDefault[key] == mpl.rcParamsOrig[key]:
print(key, mpl.rcParamsDefault[key], mpl.rcParamsOrig[key])
## backend agg Qt5Agg
import seaborn
andseaborn.reset_orig()
still look quite different to plots made before these lines. Is there a way to get rid of all seaborn effects, as if it had never been imported? – Washtub