2

enter image description here

By using ax.contour I plotted three contour curves and I would like to fill the under and or upper space of these curves with a specific color. Could you please let me know how I can do this? Here is the code for one of the curves and you can find the regarded fig too.

fig, ax = plt.subplots()
CS1 = ax.contour(X, Y, Z1, [2])
ax.clabel(CS1, inline=True, fontsize=10)
plt.show()

The filling methods in Matplotlip do not work here for these contour curves.

  • You can call something like `ax.contourf(X, Y, Z1, levels=[2, 3], colors='red', alpha=0.3)` to fill a region. It should combine nicely with `ax.contour(...)`. – JohanC Apr 14 '23 at 16:09
  • Thanks for your explanation, however, I have three data with three related contours. In fact, the contours in the fig are not related to a Data, so your idea does not work here. Do you have any if we have Z1, Z2, Z3, I mean three data and three regarded contours. – Davood Rafiei Apr 15 '23 at 07:54

0 Answers0