报错原因:
AttributeError: 'AxesSubplot' object has no attribute 'plot_wireframe'
官方文档:
Extra positional parameters to
plot_surfaceandplot_wireframePositional parameters to plot_surface and plot_wireframe other than
X,Y, andZare 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)
本文解决了一个常见的Matplotlib 3D绘图错误——'AxesSubplot'对象没有'plot_wireframe'属性的问题。通过使用正确的3D轴实例,成功绘制了三维线框图。
753





