问题
I just have a little problem concerning gnuplot:
I have a huge data file, containing several blocks of data and i just want to plot the data contained in the first line of each block. Thus, i use the every command:
plot "../path/to/data.dat" u 1:2 every ::1::1
The Problem now is, that i want to use "with lines", but gnuplot doesn't join the plotted data with lines.
There are two solutions I can think of: The first would be setting the terminal type to "table", and then plotting this new table data file. The second would be using awk within the plot command, such that I extract via awk the first line of data of each block in the original data file.
But I'm quite sure, there have to be much easier solutions?
Thanks in advance, Jürgen
回答1:
I think awk solution is very simple already
plot "<awk -v p=1 'n==p; NF{n++} !NF{n=0}' test.dat" w l, \
"test.dat" every ::1::1
With test.dat:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
来源:https://stackoverflow.com/questions/19792919/gnuplot-using-with-lines-in-combination-with-everycommand