大家晚上好,我是Matplotlib的长期用户,我最近发现了Mayavi。在
使用Matplotlib,我可以绘制一个三维曲面,其中每个轴的曲面图轮廓都是投影的,我想知道Mayavi是否也可以这样做。在
以下是我迄今为止使用Matplotlib(source)所做的工作的一个例子,但是我在互联网上还没有找到类似的方法用Mayavi绘制等高线:
了解Mayavi的人能否告诉我,我是否可以像Matplotlib一样为每个轴绘制三维轮廓?
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
fig = plt.figure()
ax = fig.gca(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)
cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
ax.set_xlabel('X')
ax.set_xlim(-40, 40)
ax.set_ylabel('Y')
ax.set_ylim(-40, 40)
ax.set_zlabel('Z')
ax.set_zlim(-100, 100)
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐