On Wednesday 16 January 2008 13:27, Jacob Keller wrote:
> Hello all,
> 
> It might just take you a few minutes to tell me how to do this:
> 
> I have a set of data in three columns xyz (resid1, resid2, value), which I 
> would like to plot as a "heat" or "color map" on the 2d rectangle formed by 
> the values xy, and colored by z. Essentially what I want is a ~1500 x 1500 
> grid with boxes color-coded by their z values. I cannot figure out how to do 
> this in gnuplot or anywhere, despite efforts to learn gnuplot and other 
> programs. Any suggestions?

Use gnuplot.

If you have complete data, i.e. every pair [x,y] is represented,
then the gnuplot command script is very simple so long as the
data file format is correct.  Two formats are possible.
Here is the one closest to what you describe.

file:
0 0 f(0,0)
0 1 f(0,1)
...
0 n f(0,n)
                   <<<< blank line.  Very important!
1 0 f(1,0)
1 1 f(1,1)
...
1 n f(1,n)
                   <<<< blank line.  Very important!
2 0 f(2,0)
... and so on


gnuplot commands:
   # You must supply actual values for min/max
   # because image mode does not autoscale
   set xrange [zmin:xmax]
   set yrange [ymin:ymax]
   set cbrange [zmin:zmax]        
   plot 'data' using 1:2:3 with image


The other option is to reformat your data into a file containing
only the z values.  [x,y] is implicit from the location in the file:

file:

f(0,0) f(0,1) ... f(0,n)
f(1,0) f(1,1) ... f(1,n)
...
f(n,0) f(n,1) ... f(n,n)

gnuplot commands:
   # this time we use a 3D command 'splot'
   set view map
   splot 'data' matrix using 1:2:3 with image

If the data is sparse, then it's still possible but the command
sequence is more complicated and it uses "with pm3d" to interpolate
a surface rather than "with image" with treats it as a complete set
of pixels.

More gnuplot sample scripts online at
    http://gnuplot.sourceforge.net/demo/

        Ethan

-- 
Ethan A Merritt            Courier Deliveries: 1959 NE Pacific
Dept of Biochemistry
Health Sciences Building
University of Washington - Seattle WA 98195-7742

Reply via email to