matplotlib绘制3d图形出现空白,解决办法

如果出现如下图空白 

 

或者出现下面报错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')
 

猜你喜欢

转载自blog.csdn.net/li1873997/article/details/130892918