I'm trying to draw 2-d contours of a 2d matrix. I am curious to know if it is normal that imshow() and contour()/contourfc() of matplotlib package work differently with respect the origin of the matrix coordinates. It appears that imshow() treats the origin of coordinates flipped with respect to contour().
I illustrate this with a quite simple example:
import numpy as np
from matplotlib import pyplot as plt
a = np.diag([1.0, 2, 3])
plt.imshow(a)
produces a nice picture with colors along the main diagonal (from left-upper corner to right-bottom corner), But if instead I execute
plt.contour(a)
the figure is a set of contours aligned along the perpendicular diagonal (form left-bottom corner to upper-right corner).
If I flip the array with numpy flipud() function
plt.contour(np.flipud(a))
then both contour() and imgshw() coincide.
Maybe is a stupid question, I apologize for that !
Thanks anyway