Search code examples
image3dgnuplotgeometry-surface

Gnuplot: 3d surface from discrete data


i need to plot the surface of a discrete 3d function, the data is this:

   0.5520000      -0.3840000       0.0000001       0.0000001
   0.5520000      -0.3760000   6.5919072e-08   5.8261450e-08
   0.5520000      -0.3680000       0.0398564       0.0335707
   0.5520000      -0.3600000   2.4211279e-08   2.6520126e-08
   0.5520000      -0.3520000       0.0000002       0.0000002
   0.5520000      -0.3440000       0.1945450       0.1962598
   0.5520000      -0.3360000       0.0794571       0.0792212
   0.5520000      -0.3280000   1.3106068e-08   1.6226917e-08
   0.5520000      -0.3200000       0.3029487       0.3209866
   0.5520000      -0.3120000       0.2192498       0.2272512
   0.5520000      -0.3040000       0.2904586       0.3077338
   0.5520000      -0.2960000       0.2505561       0.2639075

...

and i want to plot the 1:2:3 columns. I try to use the simple gnuplot command:

splot 'data.dat' u 1:2:3 with pm3d

but i receive the following warning message:

Warning: Single isoline (scan) is not enough for a pm3d plot.
       Hint: Missing blank lines in the data file? See 'help pm3d' and FAQ.

And the output is an empty 3d plot.

Could someone help me please?


Solution

  • Like the warning message tells you: you are missing blank lines in your file. For use with pm3d, the data must be organized as follows:

    x0 y0 z00
    x0 y1 z01
    ....
    x0 yN z0N
    
    x1 y0 z10
    x1 y1 z11
    ...
    x1 yN z1N
    

    etc. You must have a single blank line between consecutive x values.