Difference between revisions of "Gnuplot"

From Noah.org
Jump to navigationJump to search
Line 5: Line 5:
  
 
[[http://www.gnuplot.info/docs/gnuplot.html gnuplot documentation]]
 
[[http://www.gnuplot.info/docs/gnuplot.html gnuplot documentation]]
 +
 +
One of the first tricks I do is alias "gnuplot" to "gnuplot -persist":
 +
  alias gnuplot='gnuplot -persist'
 +
This will tell gnuplot to keep an image displayed on the screen.
 +
By default gnuplot will close a display window as soon as it finishes drawing.
 +
 +
 +
I don't run an ntp daemon.Instead, I just sync my clock once a day using ntpdate.
 +
The ntpdate log file looks like this:
 +
 +
<pre>
 +
28 Jul 04:02:41 ntpdate[4781]: step time server 192.43.244.18 offset 13.828862 sec
 +
29 Jul 04:02:45 ntpdate[19059]: step time server 192.43.244.18 offset 13.838561 sec
 +
30 Jul 04:03:36 ntpdate[17510]: step time server 192.43.244.18 offset 13.844762 sec
 +
</pre>
 +
 +
I save the output from ntpdate to a log file. I can plot the daily clock drift
 +
using this gnuplot script:
  
 
<pre>
 
<pre>
set terminal png
 
#gif small size 640,480
 
 
set title "Daily clock offset\nnegative means clock runs fast"
 
set title "Daily clock offset\nnegative means clock runs fast"
set data style fsteps
 
 
set xlabel "Date"
 
set xlabel "Date"
set timefmt "%d/%m/%y\t%H%M"
 
set yrange [ -4.6 : -4.8]
 
 
set xdata time
 
set xdata time
set xrange [ "25/06/00":"29/08/00" ]
+
set timefmt "%d %b %H:%M:%S"
 +
set format x "%d/%m"
 
set ylabel "Required offset (negative minutes fast)"
 
set ylabel "Required offset (negative minutes fast)"
set format x "%d/%m"
+
set yrange [ -1.0 : 30.0]
#\n%H:%M"
 
 
set grid
 
set grid
set key left
+
plot "ntpdate.log" using 1:10
plot "data.dat" using 1:3
 
reset
 
 
</pre>
 
</pre>

Revision as of 15:16, 2 August 2007


I use gnuplot from time to time. I don't know it well enough to do anything fancy, but I keep it in my toolbox. Most of the time I just want to plot some points from a data file.

[gnuplot documentation]

One of the first tricks I do is alias "gnuplot" to "gnuplot -persist":

 alias gnuplot='gnuplot -persist'

This will tell gnuplot to keep an image displayed on the screen. By default gnuplot will close a display window as soon as it finishes drawing.


I don't run an ntp daemon.Instead, I just sync my clock once a day using ntpdate. The ntpdate log file looks like this:

28 Jul 04:02:41 ntpdate[4781]: step time server 192.43.244.18 offset 13.828862 sec
29 Jul 04:02:45 ntpdate[19059]: step time server 192.43.244.18 offset 13.838561 sec
30 Jul 04:03:36 ntpdate[17510]: step time server 192.43.244.18 offset 13.844762 sec

I save the output from ntpdate to a log file. I can plot the daily clock drift using this gnuplot script:

set title "Daily clock offset\nnegative means clock runs fast"
set xlabel "Date"
set xdata time
set timefmt "%d %b %H:%M:%S"
set format x "%d/%m"
set ylabel "Required offset (negative minutes fast)"
set yrange [ -1.0 : 30.0]
set grid
plot "ntpdate.log" using 1:10