Difference between revisions of "Gnuplot"
From Noah.org
Jump to navigationJump to searchLine 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 title "Daily clock offset\nnegative means clock runs fast" | set title "Daily clock offset\nnegative means clock runs fast" | ||
− | |||
set xlabel "Date" | set xlabel "Date" | ||
− | |||
− | |||
set xdata time | set xdata time | ||
− | set | + | 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 | + | set yrange [ -1.0 : 30.0] |
− | |||
set grid | set grid | ||
− | + | plot "ntpdate.log" using 1:10 | |
− | plot " | ||
− | |||
</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.
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