Python Pyplot无法完全绘制曲面

2024-09-28 20:43:41 发布

您现在位置:Python中文网/ 问答频道 /正文

在附图中,您可以看到相同数据的两个绘图。左边用plot_wireframe()标绘,右边用plot_surface()标绘

像这样:

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(xm, ym, Values)

fig2 = plt.figure()
ax2 = fig2.add_subplot(111, projection='3d')
ax2.plot_wireframe(xm, ym, Values)

plt.show()

为什么会这样?plot_wireframe是正确的。例如,为什么曲面图上没有显示左上角的峰值?谢谢

the two plots of the same data

下面是数据矩阵的另一个示例:

enter image description here


Tags: 数据addplotfigpltaxsurfacefigure
1条回答
网友
1楼 · 发布于 2024-09-28 20:43:41

考虑到评论中的讨论,我认为现在的情况是,你有一个正常的线框,看起来应该是这样的,但是曲面图是3D轴对象中的2D投影。我注意到您缺少一行显示在the matplotlib surface exampleX, Y = np.meshgrid(X, Y)中。假设我在正确的轨道上,您需要在axes.plot_surface()调用之前插入一个类似的语句。你知道吗

相关问题 更多 >