]> git.itanic.dy.fi Git - log-plotter/blobdiff - cell_volt.plot
plotter scripts: Add automatic x-axis tick scaling
[log-plotter] / cell_volt.plot
index 2c102ba501e3d6587278588f0614c5bbeef822f2..6266962be1ce32f1f9eeadb0d3dc6754e6c7693e 100644 (file)
@@ -49,15 +49,15 @@ set format x "%.0f"
 set grid y
 
 # extract the 'time' cell for xtics
-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;
+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;
 
 # Draw the plot based on log-plotter's variable cell-count
 if (cell_cnt==1) plot  datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \