|
Packit |
0986c0 |
#
|
|
Packit |
0986c0 |
# Exercise the "stats" command.
|
|
Packit |
0986c0 |
# Skip this demo cleanly if the stats option was not configured.
|
|
Packit |
0986c0 |
#
|
|
Packit |
0986c0 |
if (!strstrt(GPVAL_COMPILE_OPTIONS,"+STATS")) {
|
|
Packit |
0986c0 |
print "No support for stats command"
|
|
Packit |
0986c0 |
} else {
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
set title "Use of stats command to find min/max/mean before plotting\nOne data column"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
set style data line
|
|
Packit |
0986c0 |
set offset 0,0,.5,.5
|
|
Packit |
0986c0 |
set autoscale fix
|
|
Packit |
0986c0 |
set key left Left
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
stats 'orbital_elements.dat' index 1 using 2 prefix "A"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
set arrow 1 from A_index_min, graph 0.1 to A_index_min, A_min fill
|
|
Packit |
0986c0 |
set arrow 2 from A_index_max, graph 0.9 to A_index_max, A_max fill
|
|
Packit |
0986c0 |
set label 1 at A_index_min, graph 0.1 "min" center offset 0,-1
|
|
Packit |
0986c0 |
set label 2 at A_index_max, graph 0.9 "max" center offset 0,1
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
plot 'orbital_elements.dat' index 1 using 0:2 title " Data" lw 2, \
|
|
Packit |
0986c0 |
A_mean title " Mean"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
pause -1 "Hit return to continue"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
set title "Use of stats command to find min/max/mean before plotting\nTwo data columns"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
f(x) = log(1+x)
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
stats 'orbital_elements.dat' index 1 using (f($0)):2 prefix "B"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
set arrow 1 from B_pos_min_y, graph 0.1 to B_pos_min_y, B_min_y fill
|
|
Packit |
0986c0 |
set arrow 2 from B_pos_max_y, graph 0.9 to B_pos_max_y, B_max_y fill
|
|
Packit |
0986c0 |
set label 1 at B_pos_min_y, graph 0.1 "min" center offset 0,-1
|
|
Packit |
0986c0 |
set label 2 at B_pos_max_y, graph 0.9 "max" center offset 0,1
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
plot 'orbital_elements.dat' index 1 using (f($0)):2 title " Data" lw 2, \
|
|
Packit |
0986c0 |
B_mean_y title " Mean", \
|
|
Packit |
0986c0 |
B_slope * x + B_intercept title "Linear fit"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
pause -1 "Hit return to continue"
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
reset
|
|
Packit |
0986c0 |
}
|