I have several 3d functions. I would like two plot the contour plots of them in the same figure to see the difference between them. I expect to see some crossings between contours of two functions. Here is my code:
plt.contour(xi, yi, F)
plt.contour(xi, yi, F1)
plt.show()
But, it seems that the first one is erased at the end, since I see only one function without any crossing of contours. Is it possible to figure this out somehow?
I did a quick test and I see both contours. The fact that they use common colors can be misleading. Try this :
plt.contour(xi, yi, F, colors='red')
plt.contour(xi, yi, F1, colors='blue')
plt.show()
A self-contained example :
import matplotlib.pyplot as plt
import numpy as np
X = np.linspace(0, 1, 10)
Y = np.linspace(0, 1, 10)
x,y = np.meshgrid(X,Y)
f1 = np.cos(x*y)
f2 = x-y
plt.contour(x,y,f2,colors='red')
plt.contour(x,y,f1,colors='blue')
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