File: stats.dem

package info (click to toggle)
gnuplot 5.4.1%2Bdfsg1-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,316 kB
  • sloc: ansic: 85,877; cpp: 7,440; makefile: 2,548; javascript: 2,322; sh: 1,542; lisp: 667; perl: 304; pascal: 191; tcl: 88; python: 46
file content (46 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# Exercise the "stats" command.
# Skip this demo cleanly if the stats option was not configured.
#
if (!strstrt(GPVAL_COMPILE_OPTIONS,"+STATS")) {
    print "No support for stats command"
} else {

set title "Use of stats command to find min/max/mean before plotting\nOne data column"

set style data line
set offset 0,0,.5,.5
set autoscale fix
set key left Left

stats 'orbital_elements.dat' index 1 using 2 prefix "A"

set arrow 1 from A_index_min, graph 0.1 to A_index_min, A_min fill
set arrow 2 from A_index_max, graph 0.9 to A_index_max, A_max fill
set label 1 at A_index_min, graph 0.1 "min" center offset 0,-1
set label 2 at A_index_max, graph 0.9 "max" center offset 0,1

plot 'orbital_elements.dat' index 1 using 0:2 title "  Data" lw 2, \
     A_mean title "  Mean"

pause -1 "Hit return to continue"

set title "Use of stats command to find min/max/mean before plotting\nTwo data columns"

f(x) = log(1+x)

stats 'orbital_elements.dat' index 1 using (f($0)):2 prefix "B"

set arrow 1 from B_pos_min_y, graph 0.1 to B_pos_min_y, B_min_y fill
set arrow 2 from B_pos_max_y, graph 0.9 to B_pos_max_y, B_max_y fill
set label 1 at B_pos_min_y, graph 0.1 "min" center offset 0,-1
set label 2 at B_pos_max_y, graph 0.9 "max" center offset 0,1

plot 'orbital_elements.dat' index 1 using (f($0)):2 title "  Data" lw 2, \
     B_mean_y title "  Mean", \
     B_slope * x + B_intercept title "Linear fit"

pause -1 "Hit return to continue"

reset
}