calling python (matplotlib) from c++

S

someone

Hi all,

I want to call python (matplotlib) from C++. I use ubuntu linux and
compile with "-lpython2.7". Besides that, I have this line included:

#include <python2.7/Python.h>

I can then do something like this:

Py_Initialize();
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print 'PYTHON RUNNING =============='");
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
// Py_Main(argc, argv); // start up the python interpreter
Py_Finalize();

However - I cannot seem to pass two arrays of data, so I can plot the
data using matplotlib... I cannot even start matplotlib... Please
help/advice/come up with suggestions, someone who knows what to do :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top