You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter.
There are 2 files matplotlibcpp.cpp and matplotlibcpp.h
I downloaded the matplotlibcpp.h file from this repo
Here is the example file matplotlibcpp.cpp
#include"matplotlibcpp.h"
#include<cmath>namespaceplt= matplotlibcpp;
intmain()
{
// Prepare data.int n = 5000;
std::vector<double> x(n), y(n), z(n), w(n,2);
for(int i=0; i<n; ++i) {
x.at(i) = i*i;
y.at(i) = sin(2*M_PI*i/360.0);
z.at(i) = log(i);
}
// Set the size of output image to 1200x780 pixelsplt::figure_size(1200, 780);
// Plot line from given x and y data. Color is selected automatically.plt::plot(x, y);
// Plot a red dashed line from given x and y data.plt::plot(x, w,"r--");
// Plot a line whose name will show up as "log(x)" in the legend.plt::named_plot("log(x)", x, z);
// Set x-axis to interval [0,1000000]plt::xlim(0, 1000*1000);
// Add graph titleplt::title("Sample figure");
// Enable legend.plt::legend();
// Save the image (file format is determined by the extension)plt::save("./basic.png");
}
In file included from matplotlibcpp.cpp:1:
./matplotlibcpp.h:5:10: fatal error: 'Python/Python.h' file not found
#include <Python/Python.h>
^~~~~~~~~~~~~~~~~
1 error generated.
The text was updated successfully, but these errors were encountered:
fatal error: 'Python/Python.h' file not found
I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter.
There are 2 files
matplotlibcpp.cpp
andmatplotlibcpp.h
I downloaded the
matplotlibcpp.h
file from this repoHere is the example file
matplotlibcpp.cpp
I compile using
and got this error
The text was updated successfully, but these errors were encountered: