Suppose I have a data file that consists of multiple blocks like the following:
0 0
1 1
2 2
3 3
4 4
5 5
Now let us plot this file:
plot "data.dat" w lines
The output is two lines, with a gap from x = 2
to x = 3
. However, if you remove the \n
in the data file, effectively forming one block, the same command will produce a continuous plot. In a sense, when there are data blocks, gnuplot reads and interprets them separately, leading to independent plots.
Question: Is there a way to keep a file's many data blocks and yet have gnuplot read all the blocks in one coherent way, just as if the file was one single data block?
Clarification: What I refer to as "data blocks" are the STATS_blank
in gnuplot.
A little cheat with awk
:
plot "<awk -F'[ ]' '/\\S/ {printf(\"%f %f\\n\",$1,$2)}' <data.dat " w l
will ignore blank lines. (\S
<=> 'non-whitespace')
NOTE
-F'[ ]'
and printf
are overinsurances:
plot "<awk '/\\S/ {print $0}' <data.dat " w l
is almost as good as.