Wednesday 15 January 2014

Interfacing C/C++ to Gnuplot

Over the years I have used many different applications for plotting DSP and scientific data (Matplotlib, MathGL, Grace etc) all have their benefits and disadvantages but I have never strayed far from the excellent Gnuplot.

Back in the early 1990s I wrote a library that worked with both the Borland and Microsoft C compilers (The Numerix Host Library) for displaying DSP data on old VGA screens. This library included it's own graphical plotting functions but over the years I have rewritten most of the library to interface to Gnuplot via an API that I call Gnuplot/C.

Gnuplot/C uses pipes to send data from C/C++ to Gnuplot's much more powerful graphical front-end.

Late last year, while updating some class notes for the Oxford University DSP Course, with some graphs generated using Gnuplot/C, I realized that it was about time I finally got around to documenting the API and making it available to others.

This was a perfect project for the Christmas/New Year holiday period and while the majority of the code was written then, the documentation took a little longer ;-)

Gnuplot/C is available from

One day I will port this to Python but maybe that is for another holiday ;-)

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries :