嘿,我想用3d matplotlib python绘制一个函数。我想绘制的函数是x = i,其中i从0延伸到1,增量为0.20。所以基本上4个垂直平面就像我分享的图片一样。
你可以将这些平面创建为曲面图。
下面是一个例子。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
X, Y = np.meshgrid(np.arange(-6, 6), np.arange(-6, 6))
Z = 0*X
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, alpha=0.5) # the horizontal plane
ax.plot_surface(Z, Y, X, alpha=0.5) # the vertical plane