tags:

views:

485

answers:

2

I've been using matplotlib in a Python project. It is great.

I have now to plot data in a C++ project. Is anyone aware of a plotting library in C or C++?

Note that I cannot accept GPL licensed libraries.

+2  A: 

ROOT provides substantial plotting support and is provided under the terms of the LGPL, which may or may not be acceptable to you.

Note however, that this is rather more than just a plotting library.

dmckee
Now he has two problems.
honk
+4  A: 

Hi

You can try something like this:

#include "Python.h"

int main()
{
   Py_Initialize();
   PyRun_SimpleString("import pylab");
   PyRun_SimpleString("pylab.plot(range(5))");
   PyRun_SimpleString("pylab.show()");
   Py_Exit(0);
   return 0;
}

compile it with(I am using a Mac):

g++ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/ plot.cpp -lpython2.6

Although you need to figure out how to make your data accessible to matplotlib (try writing it to a file and reading it back).

Hope that helps,

Raj

Raj
Great, this works. But I wanna do something more complex, with live data and ... live display.
Didier Trosset