문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

The following will take an input file of more that 2 columns, sort it and add an empty line whenever the first column changes, i.e. what Gnuplot requires:

sort -k 1,1 -k 2,2 -n infile.txt | \
awk 'BEGIN{pr=0}{if(NR>1){if($1!=pr){print ""}} pr=$1;print $0}' >outfile.txt

Explanation:

numerically (-n) sort your input first with respect to the first column (-k 1,1), then to the second (-k 2,2) and will pipe the result to awk which will add a newline if the previous line's first field is not the same as the current one's.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top