Python - Intensity map without interpolation
<p>I need to make an intensity plot.</p>

<p>I have three lists of x,y,z values, imported from real data: <code>x_list, y_list, z_list</code>. Each of these lists contain 200 values. Therefore there is a corresponding value of z for each x,y couple.</p>

<p>I have tried the following, after some search on the web and another question on StackOverflow:</p>

<pre><code>import numpy as np
import pylab as plt

data = np.loadtxt('data.d')
x_list = data[:,0]
y_list = data[:,1]
z_list = data[:,2]

from scipy.interpolate import interp2d

f = interp2d(x_list,y_list,z_list,kind="linear")

x_coords = np.arange(min(x_list),max(x_list)+1)
y_coords = np.arange(min(y_list),max(y_list)+1)
Z = f(x_coords,y_coords)

fig = plt.imshow(Z,
           extent=[min(x_list),max(x_list),min(y_list),max(y_list)],
           origin="lower")


fig.axes.set_autoscale_on(False)
plt.scatter(x_list,y_list,400,facecolors='none')

plt.show()
</code></pre>

<p>This uses interpolation, and I am not sure that it is exactly what I need. 
Is there a way to plot ONLY the 200 values of z, corresponding to the 200 x,y couples, for which I have a given value, withuot interpolation? Obviously I still need some kind of "intensity relation", I cannot just have a scatter plot without a way of interpreting the "intensity" of the 200 z values.</p>

<p>From what I understand, you want to display xyz points in a 2D graph where z-value would be represented by a color. If that is correct the solution is as simple as stating <code>facecolors=z_list</code> in your scatter plot:</p>

<pre><code>data = np.random.rand(200,3)
x_list = data[:,0]
y_list = data[:,1]
z_list = data[:,2]

plt.scatter(x_list,y_list,200,facecolors=z_list)

plt.colorbar()
plt.show()
</code></pre>

<p>Example output :
<a href="http://i.stack.imgur.com/nQahF.png" rel="nofollow"><img src="http://i.stack.imgur.com/nQahF.png" alt="enter image description here"></a></p>

python matplotlib