gpt4 book ai didi

python - pandas.scatter_matrix 函数开始绘制模糊和损坏的图

转载 作者:太空宇宙 更新时间:2023-11-04 02:58:54 29 4
gpt4 key购买 nike

pandas.scatter_matrix 的功能停止在 Jupyter Notebook 中正常工作。

它一直画这个情节:

enter image description here

现在它是这样显示的:

enter image description here

我不知道是什么影响了它。

可能是什么原因?

更新

看起来在之前的单元格中使用 seaborn 热图会损害功能。

如何从 seaborn.heatmap 中恢复?

更新 2

matplotlib.style.use('classic')

没有完全恢复

enter image description here

更新 3

下面的命令

plt.rcParams.update(plt.rcParamsDefault)

也仅部分恢复。

最佳答案

更新:

this great answer 中所述:

%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.

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>

enter image description here

在我们执行import seaborn之后:

In [7]: import seaborn

In [8]: s.plot()
Out[8]: <matplotlib.axes._subplots.AxesSubplot at 0xf4782e8>

enter image description here

让我们“修复”它:

In [10]: plt.style.use('classic')

In [11]: s.plot()
Out[11]: <matplotlib.axes._subplots.AxesSubplot at 0xf6e3cc0>

enter image description here

关于python - pandas.scatter_matrix 函数开始绘制模糊和损坏的图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41598190/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com