You should be able to set it back to default by:
import matplotlib as mpl
mpl.rcParams.update(mpl.rcParamsDefault)
In ipython
, things are a little different, especially with inline
backend:
In [1]:
%matplotlib inline
In [2]:
import matplotlib as mpl
import matplotlib.pyplot as plt
In [3]:
inline_rc = dict(mpl.rcParams)
In [4]:
plt.plot(range(10))
Out[4]:
[<matplotlib.lines.Line2D at 0x72d2510>]
In [5]:
mpl.rcParams.update(mpl.rcParamsDefault)
plt.plot(range(10))
Out[5]:
[<matplotlib.lines.Line2D at 0x7354730>]
In [6]:
mpl.rcParams.update(inline_rc)
plt.plot(range(10))
Out[6]:
[<matplotlib.lines.Line2D at 0x75a8e10>]
Basically, %matplotlib inline
uses its own rcParams
. You can grab that from the source, but the arguably easier way is probably just save the rcParams
as inline_rc
after %matplotlib inline
cell magic in this example, and reuse that later.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…