Can anyone give me an example of how to mark a specific level in a contour map? I would like to mark the level which is the black line in this plot:
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 specific plot can be obtained here dpaste data for contour plot
Take a look at this example from the matplotlib gallery for contour plot functionality. By modifying the levels in your script, as well as changing some of the references, leads to :
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With