]> git.itanic.dy.fi Git - log-plotter/blobdiff - volt_cur.plot
plotter scripts: Add automatic x-axis tick scaling
[log-plotter] / volt_cur.plot
index 4604338237abb8cb116baf6d028b010ad6878b78..921f3d98edf0e6efb0fafad988cf99c9bb8fcc37 100644 (file)
@@ -48,15 +48,15 @@ set y2tics border
 set grid y
 
 # extract the 'time' cell for xtics
-stats datafile every ::::0 using 3 nooutput
-time = int(STATS_min)
+stats datafile nooutput
+stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput
+time= int(STATS_max)
 
-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;
+#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;
 
 # Draw the plot based on log-plotter's variable cell-count
 plot   datafile using ($3/60):($5) axes x1y1 with lines title "Voltage", \