Make a 2D pixel plot with matplotlib
Based on the way it looks like your x,y,temp triples are ordered (listed out in rows), you can just reshape the "temp" column.
E.g.
import numpy as npimport matplotlib.pyplot as pltimport matplotlib.cm as cmx,y,temp = np.loadtxt('data.txt').T #Transposed for easier unpackingnrows, ncols = 100, 100grid = temp.reshape((nrows, ncols))plt.imshow(grid, extent=(x.min(), x.max(), y.max(), y.min()), interpolation='nearest', cmap=cm.gist_rainbow)plt.show()
Edit: You probably actually wanted hsv
is the "rainbow" colormap you were referring to.matplotlib.cm.gist_rainbow
. matplotlib.cm.hsv
goes back to red at the bottom. See here: https://matplotlib.org/users/colormaps.html for a list of colormaps.
If your x,y,temp triplets aren't actually ordered, then you'll need to regrid your points. I showed an example of this in my answer to your previous question.