]> git.itanic.dy.fi Git - log-plotter/blobdiff - bal.plot
plotter scripts: Add automatic x-axis tick scaling
[log-plotter] / bal.plot
index df161e65a54a28240e8d7891df05f7e9b9fa969b..e580b88d947ca1022d7f878b9b9c0ac0b89fe1fa 100644 (file)
--- a/bal.plot
+++ b/bal.plot
@@ -45,16 +45,16 @@ set grid y
 set xlabel "Time [minutes]"
 set format x "%.0f"
 
-# extract the 'time' cell for xtics based on tital time
-stats datafile every ::::0 using 3 nooutput
-time = int(STATS_min)
-
-if (time <= 120) set xtics 0.5 nomirror;
-if (time <= 300) set xtics 1 nomirror;
-if (time <= 900) set xtics 2 nomirror;
-if (time <= 1200) set xtics 3 nomirror;
-if (time <= 1800) set xtics 5 nomirror;
-if (time > 1800) set xtics 10 nomirror;
+# extract the 'time' cell for xtics
+stats datafile nooutput
+stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput
+time= int(STATS_max)
+
+#set xtics based on elapsed time
+set xtics 1 nomirror
+if (time > 300) set xtics 1 nomirror;
+if (time > 900) set xtics 2 nomirror;
+if (time > 1800) set xtics 5 nomirror;
 
 # Count average-value for balance sero-line
 samples(x) = $0 > 4 ? 5 : ($0+1)