3

Here is an answer that lets one plot a plane using matplotlib, but if one uses the vector [1, 0, 0], nothing gets plotted! This makes sense, because of the way the code is set up (meshgrid is on X-Y plane, and then Z points determine the surface.

So, how can I plot the X = 0 plane using matplotlib?

Community
  • 1
  • 1
bzm3r
  • 3,113
  • 6
  • 34
  • 67

1 Answers1

7

This is less generic than the example that you linked, but it does the trick:

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()

enter image description here

hitzg
  • 12,133
  • 52
  • 54