I have a 3 data sets, X,Y,Z which are my axes and my data respectively. They are well defined, i.e.
len(X) = len(Y) = len(Z) = len(Z[i]) = N for i in range(0,N).
I would like to make a similar to a contourf plot (I already made it), but using discrete axes, like a “contour squares”, where each square (x,y) has a color given by the Z value (which is a float value).
So far I’m using the contourf(X,Y,Z), but it makes some interpolations that I don’t want, I need a better visualization with squares.
Does anyone knows how to do it?
Thanks
You should use matshow or imshow plotting functions.
An important argument here is the interpolation one.
Check this example from the matplotlib gallery to see some examples.
By using matshow(), keyword arguments are passed to imshow().
matshow() sets defaults for origin, interpolation (=’nearest’), and aspect.
here is an example from my own work…
…which returns this plot: