连接3D曲面的端点

时间:2019-02-27 14:05:51

标签: python numpy matplotlib

我有这组数据,我想使用python(基本上是numpy和matplotlib)将其绘制在3D曲面和轮廓中。在这种情况下,我将X和Y轴作为我的自由坐标,并将结果描述为z轴上的数据集。

我已经检查了很多次数据,并且这些数据的格式正确地符合了我的需要。 Here is a plot of the set in a scatter manner

问题是当我尝试使用连接(X,Y)网格端点的曲面图时,关闭曲面并使包含我想要信息的图像部分不可见有。 Here is the output I have regarding the surface plothere is the output regarding the contour plot

与曲面图有关的代码(仅是绘图部分)为

#...
#X and Y are the coordinates values
#E is the results I am trying to plot

fig = plt.figure()

ax = fig.gca(projection='3d')
surf = ax.plot_surface(X, Y, E, cmap=cm.coolwarm, linewidth=0, antialiased=False)

ax.scatter3D(X, Y, E, cmap='Greens')
fig.colorbar(surf, shrink=0.5, aspect=5)
plt.show()

这是与轮廓图有关的代码

fig, ax = plt.subplots()
CS = ax.contourf(X, Y, E, 10, cmap='RdGy')
ax.clabel(CS, inline=1, fontsize=10)
ax.set_title('Simplest default with labels')
fig.colorbar(CS, shrink=0.5, aspect=5)
plt.show()

0 个答案:

没有答案