import matplotlib.pyplot as plt
plt.contour([X, Y,] Z, [levels], ** kwargs)
或
matplotlib.pyplot.contour([X, Y,] Z, [levels], ** kwargs)
作用:绘制轮廓线,类于等高线 。
contour and contourf draw contour lines and filled contours, respectively.
参数:
X,Y :值Z的坐标。
X和Y必须都是2-D,且形状与Z相同,或者它们必须都是1-d,这样len(X)== M是Z中的列数,len(Y)== N是Z中的行数。
Z : 绘制轮廓的高度值。
levels: int或类数组,确定轮廓线/区域的数量和位置。
返回:
c : QuadContourSet
示例1
code
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1, 10)
y = x.reshape(-1, 1)
h