Reputation: 164
I am plotting contour plots using matplotlib and want to plot contour lines having an accuracy of almost eight digits (this is priority) and between a certain range may be 0.99999999 ≤ |G| ≤ 1.00000001. I have written the following code:
khmax = np.arange(0,np.pi,0.01)
Ncmax = np.arange(0,np.pi,0.01)
[X, Y] = np.meshgrid(Ncmax,khmax)
fig, ax = plt.subplots()
contour = plt.contour(X,Y,mod_G,30)
ax.set_title('magnitude of G')
ax.set_xlabel('Ncmax')
ax.set_ylabel('khmax')
ax.clabel(contour, inline= True, inline_spacing = -1,fmt = '%1.7f',fontsize=8)
plt.show()
The above code helps in plotting 30 contour lines of values like 20, 30 (just for an example). I also want to shade contours in a certain range. I tried finding using matplotlib but couldn't find any good result.
I want to get a plot somewhat in the same way as shown in the attached figure (plotting contour lines with an accuracy of 7 to eight decimal places and shading the required region).
Upvotes: 0
Views: 929