我有以下代码来创建一个圆锥体,稍后将为其应用位移场。在下图中,您可以看到顶部绘制了一些大三角形,但底部没有绘制。我相信有一些内部隐藏参数可以告诉plot_trisurf()
应该创建三角形的距离,否则它们也应该在底部创建。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from numpy import linspace, interp, meshgrid, sin, cos, pi
numel_circum = 120
L = 38.
rb, rt = (38., 16.)
t1, t2 = (0, 2*pi)
rav = ( rb - rt )*rt/rb + rt
perav = (t2-t1) * rav
elsize_L = perav / numel_circum
numel_L = int(round(L/elsize_L,0))
ts = linspace(t1, t2, numel_circum)
r = lambda z: interp( z, [0, L], [rb, rt] )
zs = linspace(0, L, numel_L)
ts, zs = meshgrid( ts, zs )
ys = r(zs)*sin(ts)
xs = r(zs)*cos(ts)
# plotting
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_trisurf(xs.flatten(), ys.flatten(), zs.flatten(),
cmap=cm.jet, linewidth=0.2)
plt.show()