pandas.scatter_matrix 的功能停止在 Jupyter Notebook 中正常工作。
它一直画这个情节:
现在它是这样显示的:
我不知道是什么影响了它。
可能是什么原因?
更新
看起来在之前的单元格中使用 seaborn 热图会损害功能。
如何从 seaborn.heatmap 中恢复?
更新 2
matplotlib.style.use('classic')
没有完全恢复
更新 3
下面的命令
plt.rcParams.update(plt.rcParamsDefault)
也仅部分恢复。
请您参考如下方法:
更新:
如 this great answer 中所述:
%matplotlib inlineuses its ownrcParams. You can grab that from the source, but the arguably easier way is probably just save thercParamsasinline_rcafter%matplotlib inlinecell magic in this example, and reuse that later.
saved_plt_params = plt.rcParams # call it before `import seaborn` !
import seaborn
...
plt.rcParams = saved_plt_params
旧答案:
这应该“修复”样式:
matplotlib.style.use('classic')
注意:您可能想阅读有关 matplotlib styles 的内容
演示:
In [4]: s = pd.Series(np.random.randn(100)).add(.1).cumsum()
In [5]: %matplotlib
Using matplotlib backend: Qt5Agg
In [6]: s.plot()
Out[6]: <matplotlib.axes._subplots.AxesSubplot at 0xbe16d68>
在我们执行import seaborn之后:
In [7]: import seaborn
In [8]: s.plot()
Out[8]: <matplotlib.axes._subplots.AxesSubplot at 0xf4782e8>
让我们“修复”它:
In [10]: plt.style.use('classic')
In [11]: s.plot()
Out[11]: <matplotlib.axes._subplots.AxesSubplot at 0xf6e3cc0>
