There is the plotting style with steps
in different variations.
However, in order to get to data points you first have to sum up your durations, but then the last horizontal line will be missing.
You could use the plotting style with vectors
or xerrorbars
then you could easily plot durations, but then the vertical lines would be missing.
So, I guess you either have to
- plot the data twice for horizontal lines and vertical lines using
with vectors
- or plot the data
with steps
and only add the last horizontal line with vectors
.
The following example is using the latter approach.
If it is not critical, you might want to skip the last horizontal line to simplify the plot command.
Depending on your input data the plot command will be different. First graph with column data, second graph data with row data. gnuplot prefers data in columns, but for data in rows you can use the option matrix
(actually, a 1 x 125 matrix)
- you sum up your durations in the variable
x1
. x0
is the previous value.
- since you have alternating high/low data, you get the y-values using modulo operator
%
.
Data:
SO75553813_col.dat
125:
83
84
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
84
83
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
82
84
83
84
83
84
83
84
83
84
84
84
83
84
83
84
83
84
83
84
83
86
497
84
90
84
93
84
95
84
181
99
83
102
83
104
83
179
91
84
177
178
181
99
83
184
103
84
96
84
175
176
179
97
83
182
185
186
180
174
177
95
83
98
83
100
83
184
187
96
83
92
83
94
83
96
83
98
83
100
83
184
187
89
SO75553813_row.dat
125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89
Script:
### plottting high low signals
reset session
FILE_COL = "SO75553813_col.dat"
FILE_ROW = "SO75553813_row.dat"
set offsets graph 0.05, graph 0.05, graph 0.1, graph 0.1
set xrange[:] noextend
set key noautotitle
set multiplot layout 2,1
set title "column data"
plot x1=0 FILE_COL u (x0=x1, x1=x1+$1, x0):(y0=int($0+1)%2) skip 1 w steps lc "red", \
'+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "red"
set title "row data"
set datafile separator ":,"
plot x1=0 FILE_ROW matrix u (x0=x1, x1=x1+$3, x0):(y0=int($1)%2) every ::1 w steps lc "blue", \
'+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "blue"
unset multiplot
### end of script
Result:
