报错原因:
AttributeError: 'AxesSubplot' object has no attribute 'plot_wireframe'
官方文档:
Extra positional parameters to
plot_surface
andplot_wireframe
Positional parameters to plot_surface and plot_wireframe other than
X
,Y
, andZ
are deprecated. Pass additional artist properties as keyword arguments instead.
链接: API Changes for 3.4.0 — Matplotlib 3.5.1 documentation
解决办法:
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot_wireframe(X, Y, Z)