Mark a certain level in the outline map on matplotlib

Can someone give me an example of how to mark a certain level on a contour map? I would like to point out the level, which is the black line in this plot:

Contour map in which I want to mark a level

I am using the following code:

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()

And the data for this particular graph can be obtained here dpaste data for the contour plot

+4
source share
1 answer

Check out this example from the matplotlib gallery for outline graph functionality. By changing levels in a script, as well as changing some links, you can:

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()

enter image description here

+5
source

Source: https://habr.com/ru/post/1546058/


All Articles