如何绘制垂直三维平面?

问题描述 投票:0回答:1

见图

嘿,我想用3d matplotlib python绘制一个函数。我想绘制的函数是x = i,其中i从0延伸到1,增量为0.20。所以基本上4个垂直平面就像我分享的图片一样。

python matplotlib 3d
1个回答
0
投票

你可以将这些平面创建为曲面图。

下面是一个例子。

enter image description here

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
© www.soinside.com 2019 - 2024. All rights reserved.