Menu

Gnuplot Pause

Help
2008-08-29
2013-02-10
  • Martin Reekie

    Martin Reekie - 2008-08-29

    I have a "C" program that collects data from hardware, processes       
    it, and then the result has to go on a screen.  It has to be run in
    Windows *OR* Linux, with no real difference visible to the user.   

    The obvious answer is Gnuplot, and that's what I am now using.  The
    Windows and Linux versions vary a fair bit, but I can either work around
    the differences or live with them.  The problem is what happens when I'm
    finished.

    I run gnuplot (or wgnuplot) by getting my "C" program to write a gnuplot
    script, and then I call gnuplot from the "C" program, pointing it at the
    script file I have just written.

    The last command in the script is "pause -1".  On Windows that brings up
    a pop-up and everything freezes till I click on "OK".  On Linux I think
    it freezes till I hit "Return".

    What I want to happen is that the graphics window starts up the first
    time data arrives, and then re-draws every time the "C" program realises
    that new data has arrived and wants to replot.  This will need the "C"
    program to "unfreeze" gnuplot and redraw the window.  How can this be done?

     
    • Hans-Bernhard Broeker

      What your C programs needs to do is switch to a completely different method of driving gnuplot.  You need a pipe to gnuplot (popen() or _popen() on most platforms), through which you send all the commands you want gnuplot to execute --- including a "replot" when you want one.  On Windows, you'll have to use pgnuplot for this, instead of the regular wgnuplot.

      Oh, and no "pause -1" over a pipe.  It just doesn't make sense.

       

Log in to post a comment.