在matplotlib上标记轮廓图中的特定级别

Ohm*_*Ohm 7 python matplotlib contour

谁能给我一个如何在等高线图中标记特定等级的例子?我想标记该图中黑线的水平:

我要标记关卡的轮廓图

我使用以下代码:

plt.figure()

CS = plt.contour(X, Y,log_mu,levels = [np.log10(5e-8),np.log10(9e-5)])
CS = plt.contourf(X, Y,log_mu)
CB = plt.colorbar(CS, shrink=0.8, extend='both')

plt.xscale('log')
plt.yscale('log')

plt.show()
Run Code Online (Sandbox Code Playgroud)

并且可以在此获得该特定图的数据,用于等高线图的dpaste数据

mta*_*add 9

从matplotlib库中查看此示例,了解等高线图功能.通过修改脚本中的级别以及更改某些引用,可以导致:

plt.figure()

CS = plt.contour(X, Y,log_mu,levels = [-7,-8],
                 colors=('k',),linestyles=('-',),linewidths=(2,))
CSF = plt.contourf(X, Y,log_mu)
plt.clabel(CS, fmt = '%2.1d', colors = 'k', fontsize=14) #contour line labels
CB = plt.colorbar(CSF, shrink=0.8, extend='both')

plt.xscale('log')
plt.yscale('log')

plt.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述