0e8ed5eef79f0beb99379187a905f1e2100ecb91
4 echo "Usage: $0 sleeplog.txt"
9 graphout
="${in%%.*}.png"
10 test -n "$2" && graphout
="$2";
13 last
="$(tail -n 1 "$in" | cut -d ' ' -f 4)"
14 test "$last" -gt 0 && last
="motion" || last
="peace";
16 #Approximate size of graph
17 size
="$(tail -n 1 "$in" | cut -d . -f 1)"
18 test $size -gt 3600 && size
="$(( $size/10 ))" #For prolonged periods
19 size
="$(( 600 + $size ))"
23 set output "$graphout"
24 set terminal png size $size,400
26 set title "Sleep motions (current state: $last)"
34 #set format x "%H:%M:%S"
40 "$in" using 2:5 title "Sensor state" with steps,\
41 "" using 2:(\$6*2) title "Avg. 10s" with lines,\
42 "" using 2:(\$7*3) title "Avg. 30s" with lines,\
43 "" using 2:(\$8*3) title "Avg. 60s" with lines,\
44 "" using 2:(\$9*3) title "Avg. 90s" with lines,\
45 "" using 2:(\$10*4) title "Avg. 120s" smooth bezier\
This page took 0.278873 seconds and 3 git commands to generate.