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", \