ax.contour3D()函数创建三维轮廓图,它要求所有输入数据采用二维规则形式,并在每个点处判断Z数据。在这里,显示三维正弦函数的三维轮廓图。
from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt def f(x, y): return np.sin(np.sqrt(x ** 2 + y ** 2)) x=np.linspace(-6, 6, 30) y=np.linspace(-6, 6, 30) X, Y=np.meshgrid(x, y) Z=f(X, Y) fig=plt.figure() ax=plt.axes(projection='3d') ax.contour3D(X, Y, Z, 50, cmap='binary') ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z') ax.set_title('3D contour') plt.show()
参考链接
https://www.learnfk.com/matplotlib/matplotlib-3d-contour-plot.html
标签:set,无涯,Matplotlib,plt,matplotlib,轮廓图,import,np,ax From: https://blog.51cto.com/u_14033984/7863068