在滿足特定條件的情況下,您可以使用掩碼數(shù)組來掩碼AA值,例如y > 0.1*cos(x)。因此,從AA可以得到: AA_masked = np.ma.array(AA.real, mask = (y > 0.1*cos(x))) 然后你可以繪制它: CS = ax.contour(x, y, AA_masked.real)ax.clabel(CS, inline=True, fontsize=10) 作為檢查,您還可以繪制特定閾值: x_threshold = np.linspace(0, 6, 1000)y_threshold = 0.1*np.cos(x_threshold)ax.plot(x_threshold, y_threshold, linestyle = '--', color = 'red') Complete Code import numpy as npfrom numpy import sqrt, cos, sin, sinh, cosh, expfrom matplotlib import pyplot as pltdelta = 0.025X = np.arange(0, 6, delta)Y = np.arange(-1, 0.2, delta)x, y = np.meshgrid(X, Y)I = 1j # imaginary unitAA