How to plot a slicing plane with a surface with “matplotlib” in python
问题 I wonder how to create two slicing planes with a surface to two 2d figures. For example, I created a surface as below: from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt import numpy as np def f(x1, x2): return 0.5 * x1 + 0.6 * x2 + 0.2 * x1 * x1 + 0.1 * x1 * x2 + 0.3 * x2 * x2 + 4 x = np.linspace(-3, 3, 100) y = np.linspace(-3, 3, 100) xx, yy = np.meshgrid(x,y) z = f(xx, yy) # set up the figure fig = plt.figure() ax = fig.gca(projection='3d') ax.set_xlim(-3, 3) ax