matplotlib 2.0.0的默认样式的名称是什么?

Vin*_*ceP 4 python matplotlib

默认样式matplotlib 2.0看起来与所有以前的版本都非常不同。

我知道我可以使用切换到经典样式mpl.style.use('classic'),但是如何切换回新v2.0样式?是否在中列出了新的默认样式的名称matplotlib.style.available

hlt*_*hlt 5

根据API文档

default保留样式名称,以恢复为默认样式设置。

在我的发行物中,'default'没有列出matplotlib.style.available,也不是中的关键matplotlib.style.library

  • 谢谢!`default` 样式不在 `matplotlib.style.available` 中这一事实有点令人困惑。 (2认同)

Imp*_*est 5

在 matplotlib 中应用样式后,您可以通过以下方式切换回默认值

plt.rcParams.update(plt.rcParamsDefault)
Run Code Online (Sandbox Code Playgroud)

如果这发生在 jupyter notebook 中,那么您还需要调用后端,例如%matplotlib inline.