最近在画一个结构的模态图,但是后处理实在是没弄明白,求帮忙!
下面是代码
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
fig = plt.figure()
ax = Axes3D(fig)
#Pyramid side 1
xp1 = [1.1184,2.46,2.46]
yp1 = [0.5592, 1.23,2.73]
zp1 = [-1.5,0,-1.5]
verts1= [list(zip(xp1,yp1,zp1))]
cmhot = plt.cm.get_cmap("hot")
ax.add_collection3d(Poly3DCollection(verts1,cmap=cmhot))
ax.set_xlim(0,5)
ax.set_ylim(0,5)
ax.set_zlim(-2.5,5)
plt.show()
运行结果
我想要达到的结果
能让面的颜色根据x的值变化,达到类似云图的效果