GNUPLOT

- not so Frequently Asked Questions -

update 2004/9/15

About 3-Dimensional Plot (No.2)

1 | 2 | 3 | 4

How do I draw a 3-dim. grid graph from 3-Dim scattered data

Suppose your data to be plotted are 3-dimensinonal scattered data (x,y,z) with arbitrary order. With the splot command, gnuplot generates points or lines in a 3-dim. space.

# X          Y         Z
  9.862e-01 -8.062e-02   0.001
  9.786e-01 -1.134e-01   0.002
  9.720e-01 -1.382e-01   0.003
 .....   
 -1.849e-01 -2.165e-01  80.000
 -2.412e-01 -1.301e-01  90.000
 -2.611e-01 -4.825e-02 100.000
gnuplot> set xrange [-1:1]
gnuplot> set yrange [-1:1]
gnuplot> set ticslevel 0
gnuplot> splot "datafile.dat" u 1:2:3 with lines
fig/sample6.6a

In order to generate a 3-dim. grid graph from those data, use set dgrid3d. Height of each mesh is determined automatically by a weighted average of the data inside the grid. The number of mesh in the X- and Y-directions can be specified by set dgrid3d x-mesh, y-mash.

gnuplot> set dgrid3d 30,30
gnuplot> set hidden3d
gnuplot> splot "datafile.dat" u 1:2:3 with lines
fig/sample6.6b
up