I have a double pointer in C, and I want to plot it with matplotlib from C. I'm not understanding how to do that with the Python/C API. Could someone give me a simple example? A simple code could be some similar to:
#include <Python.h>
#define N 10
int main(void) {
double *a_c;
PyObject *a_python;
int i;
a_c = (double*)malloc(sizeof(double)*N);
for (i=0;i<N;i++)
a_c[i] = (double)i
//...a_python = some_function(a_c)....
/*
Py_Initialize();
PyRun_SimpleString("import matplotlib.pyplot as plt");
PyRun_SimpleString("plt.plot(a_python)"); ??
PyRun_SimpleString("plt.show()");
Py_Exit(0);
*/
return 0;
}
Thanks in advance!