如何使用 matplotlib (mpl3d) 绘制 X = 0 平面?

How does one draw the X = 0 plane using matplotlib (mpl3d)?

Here is an answer that lets one plot a plane using matplotlib,但如果使用向量 [1, 0, 0],则不会绘制任何内容!这是有道理的,因为代码设置的方式(meshgrid在X-Y平面上,然后Z点确定表面。

那么,如何使用 matplotlib 绘制 X = 0 平面?

这不如您链接的示例通用,但它确实有效:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

yy, zz = np.meshgrid(range(2), range(2))
xx = yy*0

ax = plt.subplot(projection='3d')
ax.plot_surface(xx, yy, zz)
plt.show()