gnuplot_i, a C code which allows a C or C++ program to pass data to GNUPLOT for immediate plotting, by Nicholas Devillard.

In order to use this package, you must have GNUPLOT available in your path.

The original package allowed the user to plot a pair of data vectors (x,y) by storing them in a struct designated as a "dpoint", and calling the function

void gnuplot_plot1d_var2 ( gnuplot_ctrl *handle, dpoint *d, int n_points, char *title )

My preference is to handle such data as a pair of vectors x and y. Thus, a variation of the above function has been prepared:

void gnuplot_plot1d_var2v ( gnuplot_ctrl *handle, double *x, double *y, int n_points, char *title )


gnuplot_i is available in a C version.

Related Data and Programs:

GNUFOR, a FORTRAN90 library which provides an interface to the GNUPLOT graphics library.

gnuplot_test, C codes which illustrate how a program can write data and command files so that gnuplot can create plots of the program results.



Nicholas Devillard


  1. The GNUPLOT_I homepage.
  2. Philipp Janert,
    Gnuplot in Action: Understanding Data with Graphs,
    Manning, 2008,
    ISBN: 1-933988-39-8.
  3. Thomas Williams, Colin Kelley, J Campbell, D Kotz, R Lang,
    gnuplot, An Interactive Plotting Program,
    The Free Software Foundation, 1990.
  4. The GNUPLOT Website.

Source Code:

Last revised on 26 June 2011.