Add support for timestamp_plot saving images

Change-Id: If0711592a7822502fab5d6cff602c958385a8e38
diff --git a/aos/events/logging/timestamp_plot.gnuplot b/aos/events/logging/timestamp_plot.gnuplot
index 7ad62da..94ef7e4 100755
--- a/aos/events/logging/timestamp_plot.gnuplot
+++ b/aos/events/logging/timestamp_plot.gnuplot
@@ -23,6 +23,10 @@
 offsetfile = "/tmp/timestamp_noncausal_offsets.csv"
 
 #set term qt 0
+if (ARG3 ne "" ) {
+     set term png
+     set output ARG3
+}
 
 plot samplefile12 using 1:2 title 'sample 1-2', \
      samplefile21 using 1:(-$2) title 'sample 2-1', \
@@ -30,4 +34,8 @@
      noncausalfile21 using 1:(-$3) title 'nc 2-1' with lines, \
      offsetfile using ((column(node1_index) - node1_start_time + (column(node2_index) - node2_start_time)) / 2):(column(node2_index) - column(node1_index)) title 'filter 2-1' with linespoints
 
+if (ARG3 ne "" ) {
+     exit
+}
+
 pause -1