|
From: theozh <th...@gm...> - 2017-12-01 23:27:02
|
still nobody has an idea...?
Well, since the construct
plot $Data u 1:2 every ::-1::-1
does not exist... here is an ugly workaround (see below).
It basically reverses a dataset and plots the first datapoint of each datablock.
Maybe someone else might find it useful or even knows a better and more elegant way to achieve this.
If it can be done easier using awk, gawk, sed, etc. please let me know how.
But the following is a pure gnuplot solution.
### plot the last point of each datablock
reset
$Data <<EOD
11 1
22 4
33 9
44 16
55 25
66 36
77 49
88 64
99 81
110 100
121 121
132 144
EOD
print $Data
stats $Data
print STATS_records # number of datapoints
array A[STATS_records] # helper array
array B[STATS_records] # helper array
array C[STATS_records] # helper array
# puttig the dataset into arrays
set table $Data2
plot $Data u (A[$0+1]=column(-1),column(-1)):(B[$0+1]=$1,$1):(C[$0+1]=$2,$2) with table
unset table
print $Data2
# reverse the dataset
set print $Data3
G = A[STATS_records] # initialize block indicator
do for [i=STATS_records:1:-1] {
if (A[i] != G) { print "" } # if different insert empty line / start new block
G = A[i]
print sprintf("%g %g", B[i], C[i])
}
set print
print $Data3
# plot the original values
set key top left
plot $Data u 1:2 w lp
# plot the first datapoints of each datablock of the reversed dataset
replot $Data3 u 1:2 every ::0::0 w p pt 6 ps 3 t "last point of each datablock"
### end gnuplot code
|