# This plots a long-running dataset, i.e. from 1:20 A.M. to 10 A.M. # The time offset, which is added while plotting. # # Run: gnuplot --persist -c example2.gp # Time offset in seconds since 1:20 A.M.: t_offset=3600 + 1200 # Use a common function for the time axis with both plots rt(x) = x + t_offset # Show percentage from values pc(x, c) = 100 * x / c #set term wxt 0 title 'RPi : Temperature & Light' set datafile separator "," set xdata time set timefmt "%s" set xlabel "Time (hh:mm)" set yrange [0:24] set ytics nomirror set ylabel "Temp (°C)" set y2range [0:110] set y2tics nomirror set format y2 '%2.0f%%' set y2label "Light" set key right bottom # Show light as a percentage of the maximum sensed value plot 'ttyACM0-870.csv' using (rt($1)):2 with lines title "Temp", \ 'ttyACM0-870.csv' using (rt($1)):(pc($3, 1.1)) with lines axes x1y2 title "Light"