有需求,就会有代码:
from matplotlib import pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport numpy as npfig = plt.figure()ax = plt.axes(projection='3d')xx = np.arange(-0.1, 0.1, 0.01)yy = np.arange(-0.1, 0.1, 0.01)X, Y = np.meshgrid(xx, yy)Z1 = np.arctan((1+Y)/(1+X)) - np.arctan(1)Z2 = np.arctan((1+Y)/(1-X)) - np.arctan(1)Z3 = np.arctan((1-Y)/(1+X)) - np.arctan(1)Z4 = np.arctan((1-Y)/(1-X)) - np.arctan(1)ax.plot_surface(X, Y, Z1, cmap='rainbow')ax.plot_surface(X, Y, Z2, cmap='rainbow')ax.plot_surface(X, Y, Z3, cmap='rainbow')ax.plot_surface(X, Y, Z4, cmap='rainbow')plt.show()