Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic Plotting in Gnuplot (drawnow in MATLAB)

Is it possible to create dynamic plots in Gnuplot? What I require for my purposes is that, as the data is generated through some loop, I will use gnuplot to put some marker on the x-y axis preserving the older ones. So somehow I will be able to observe the evolution of the data instead of just seeing the final batch result.

What I specially want is equivalent to "drawnow" command in MATLAB.

Although not totally related, right now I am using common lisp to generate the data in a loop and cgn in order to plot within lisp using gnuplot. (I can plot data in batch form inside common lisp using cgn which utilizes gnuplot)

Thank you very much in advance for your attention.

edit: I have a written a code in common lisp for this purpose. You can check it here :
Plotting data sequentially from emacs using Common Lisp and Gnuplot
This thread is however more general and asks dynamic plotting in gnuplot. Any suggestions are welcome.

like image 535
jkt Avatar asked Feb 17 '12 03:02

jkt


1 Answers

Unfortunately it's not easy to plot single points in gnuplot, but luckily there are some simple hacks as discussed here: Plotting a Single Point with Gnuplot. The echo method discussed there will only work in a Unix environment though.

Using this with replot instead of plot in your program should hopefully give you a graph of points evolving with time that preserves the previous points.

Another way, which is what I use with python, is that I put the data points in a file. In every iteration, I add points to the file then plot with gnuplot again. It's a little ugly, but it does the job in most cases.

like image 113
Abhranil Das Avatar answered Sep 21 '22 16:09

Abhranil Das