Difference between revisions of "Gnuplot"
From Noah.org
Jump to navigationJump to searchm |
m |
||
Line 6: | Line 6: | ||
[[http://www.gnuplot.info/docs/gnuplot.html gnuplot documentation]] | [[http://www.gnuplot.info/docs/gnuplot.html gnuplot documentation]] | ||
− | + | First I do is alias "gnuplot" to "gnuplot -persist": | |
− | + | ||
− | This will tell gnuplot to keep an image displayed on the screen. | + | <pre> |
− | By default gnuplot will close a display window as soon as it finishes drawing. | + | alias gnuplot='gnuplot -persist' |
+ | </pre> | ||
+ | |||
+ | You can also put this in your gnuplot script when you set the terminal: | ||
+ | |||
+ | <pre> | ||
+ | set terminal x11 persist | ||
+ | </pre> | ||
+ | |||
+ | 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. | ||
Line 25: | Line 34: | ||
<pre> | <pre> | ||
+ | set terminal x11 persist | ||
set data style errorlines | set data style errorlines | ||
set title "Daily clock offset\nnegative means clock runs fast" | set title "Daily clock offset\nnegative means clock runs fast" | ||
Line 42: | Line 52: | ||
<pre> | <pre> | ||
#!/usr/bin/env gnuplot | #!/usr/bin/env gnuplot | ||
− | + | set terminal x11 persist | |
set data style errorlines | set data style errorlines | ||
− | |||
set grid | set grid | ||
set xlabel 'Sectors (2Kb/sec)' | set xlabel 'Sectors (2Kb/sec)' | ||
Line 51: | Line 60: | ||
plot 'cdck-plot.dat' with lines | plot 'cdck-plot.dat' with lines | ||
− | |||
− | |||
</pre> | </pre> | ||
Revision as of 05:35, 29 November 2009
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.
First I do is alias "gnuplot" to "gnuplot -persist":
alias gnuplot='gnuplot -persist'
You can also put this in your gnuplot script when you set the terminal:
set terminal x11 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 terminal x11 persist set data style errorlines 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
other examples
For using with `cdck`
#!/usr/bin/env gnuplot set terminal x11 persist set data style errorlines set grid set xlabel 'Sectors (2Kb/sec)' set ylabel 'Reading time (usec)' #set logscale y plot 'cdck-plot.dat' with lines
old style, depricated:
set terminal png #gif small size 640,480 set title "Daily clock offset\nnegative means clock runs fast" set data style fsteps set xlabel "Date" set timefmt "%d/%m/%y\t%H%M" set yrange [ -4.6 : -4.8] set xdata time set xrange [ "25/06/00":"29/08/00" ] set ylabel "Required offset (negative minutes fast)" set format x "%d/%m" #\n%H:%M" set grid set key left plot "data.dat" using 1:10 reset