如果出现如下图空白 
或者出现下面报错MatplotlibDeprecationWarning: Axes3D(fig) adding itself to the figure is deprecated since 3.4. Pass the keyword argument auto_add_to_figure=False and use fig.add_axes(ax) to suppress this warning. The default value of auto_add_to_figure will change to False in mpl3.5 and True values will no longer work in 3.6. This is consistent with other Axes classes.

解决办法:matplotlib版本过高导致
pip install matplotlib==3.3 -i https://mirrors.aliyun.com/pypi/simple/
如果遇到AttributeError: module 'backend_interagg' has no attribute 'FigureCanvas'错误需要在
import matplotlib.pyplot as plt
前面加上以下2行语句即可
import matplotlib
matplotlib.use('TkAgg')
文章讲述了在使用Matplotlib时遇到的两个问题:一是关于Axes3D添加到figure的弃用警告,解决方案是降低matplotlib版本至3.3或修改添加方式;二是遇到了backend_interagg模块缺少FigureCanvas属性的错误,通过导入matplotlib并设置TkAgg后端可以解决。

2万+

被折叠的 条评论
为什么被折叠?



