Making C code plot a graph automatically

后端 未结 5 2136
离开以前
离开以前 2020-11-30 00:49

I have written a program which writes a list of data to a \'.dat\' file with the intention of then plotting it separately using gnuplot. Is there a way of making my code pl

5条回答
  •  一整个雨季
    2020-11-30 01:41

    You can either create a gnuplot script and spawn a process running gnuplot to plot this script from the commandline, or you may use one of the provided interfaces. For C, there is a POSIX pipe-based interface from Nicolas Devillard available here: http://ndevilla.free.fr/gnuplot/ ...and an iostream-based C++ version is available via git (see: http://www.stahlke.org/dan/gnuplot-iostream/ )

    The most portable and probably the easiest way would still be calling gnuplot to plot a script, though. As sje397 mentioned, check your documentation for the system() call in stdlib.h.

    On a sidenote, there is also GNU plotutils, which offers libplot, a library for plotting datasets, which you could use in your application. See: http://www.gnu.org/software/plotutils/

提交回复
热议问题