Difference between revisions of "Plotting data in real time"

From CUC3
Jump to navigation Jump to search
import>Csw34
 
import>Csw34
 
Line 18: Line 18:
 
</pre>
 
</pre>
   
You of course need to edit '''loop.plt''' to your plotting specifications. Once you are happy - run gnuplot with:
+
You of course need to edit ''loop.plt'' to your plotting specifications. Once you are happy - run gnuplot with:
 
<pre>
 
<pre>
 
gnuplot < test.plt
 
gnuplot < test.plt

Latest revision as of 11:12, 14 August 2008

If your code produces output in real time during a run, it can be both informative and interesting to be able to view the results as they come in. This can be done simply using the following two gnuplot scripts. Copy each into vi to produce the two script files test.plt and loop.plt

test.plt

#!/usr/bin/gnuplot -persist
# test.plt
reset
load "loop.plt"
reset

loop.plt

#!/usr/bin/gnuplot -persist
# loop.plt
plot 'out.dat' u 1:2 w l
reread

You of course need to edit loop.plt to your plotting specifications. Once you are happy - run gnuplot with:

 
gnuplot < test.plt

Thanks to Jason Green for the scripts :)