在附图中,您可以看到相同数据的两个绘图。左边用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
是正确的。例如,为什么曲面图上没有显示左上角的峰值?谢谢
下面是数据矩阵的另一个示例:
考虑到评论中的讨论,我认为现在的情况是,你有一个正常的线框,看起来应该是这样的,但是曲面图是3D轴对象中的2D投影。我注意到您缺少一行显示在the matplotlib surface example:
X, Y = np.meshgrid(X, Y)
中。假设我在正确的轨道上,您需要在axes.plot_surface()
调用之前插入一个类似的语句。你知道吗相关问题 更多 >
编程相关推荐