Thread: gnuplot and C programming

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    33

    gnuplot and C programming

    Hello, I want to know if it's possible to call gnuplot comands in a C program. And if it's possible how can I make it?

    Thank you!

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    33
    Hello again!

    Maybe I explain my problem and someone could help me. The thing is that I run a program with a lot of iterations, and in each iteration y create (modify) a file in wich I write a list of values to watch them with gnuplot. I would know if its possible to view in each iteration automatically the file. The final result will be like a video of the values of the file.

    Thanks for the help

  3. #3
    lfs addicted
    Join Date
    Nov 2007
    Posts
    49
    mmm... i am not sure to have understood, but:

    can't you create the file (as usual) and execute gnuplot with system(...) ?
    from http://www.gnuplot.info/faq/faq.html...00000000000000 it seems it is possible to output the graph in image format...

    If you are developing an embedded gnuplot widget inside a window I really don't know...

  4. #4
    lfs addicted
    Join Date
    Nov 2007
    Posts
    49

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    You can write the data set to a file and plot it within gnuplot. Then you can use the command "replot" to reload the file and plot whatever the latest data is.

    You can also create a file of commands for gnuplot to use to control it from another program.

    If you want to DYNAMICALLY control gnuplot, you need to send it a "set terminal dumb" command and then read and write commands to it through a pipe somehow.

  6. #6
    Registered User
    Join Date
    Apr 2010
    Posts
    1
    Dear All
    Could any one help me by telling me how can I call [pipe] gnu-plot from my c++ programming in a way that I can see the plot and update of my data in each cycle of iteration?

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Zombie's are back!

    I looked at the FAQ for it, but gnuplot supports piped input, only. They list a couple alternative programs for this. Have you tried them? Was Google able to offer any hits on this?

    There must be several plotting programs out there. It's just the kind of program that makes a physicist's or engineer's, mouth water.

    And welcome to the forum!

Popular pages Recent additions subscribe to a feed