|
From: theozh <th...@gm...> - 2018-10-18 19:00:26
|
sorry, there were errors in the code.
This should work now...
### finding thresholds with gnuplot
reset
# generate some dummy data
set print $Data
do for [i=1:100] {
print sprintf("%g %.3f",i*2+rand(0), rand(0)*10+i)
}
set print
print $Data
THRESHOLD = 60
set multiplot layout 2,1
set key top left
# $Dummy holds (difference to threshold) squared
set table $Dummy
plot $Data u 1:(($2-THRESHOLD)**2) with table
unset table
set logscale y
plot $Dummy u 1:2 w l
# find minimum with stats
stats $Dummy u 1:2 nooutput
MINIMUM = STATS_index_min_y
# find x and y value of $Data
set table $Dummy
plot $Data u (MIN_X=$1,$1):(MIN_Y=$2,$2) every ::MINIMUM::MINIMUM with table
unset table
set label 1 sprintf("Value %g at %g",MIN_Y, MIN_X) at graph 0.5, graph 0.9
set arrow 1 from first MIN_X, graph 0 to first MIN_X, THRESHOLD
unset logscale y
plot $Data u 1:2, THRESHOLD w l
unset multiplot
### end gnuplot code
|