Labels

Friday, October 14, 2022

using matplotlib in C++

g++  -I/usr/include/python3.5/  -I/home/user/.local/lib/python3.5
/site-packages/numpy/core/include /usr/lib/x86_64-linux-gnu/libpython3.5m.so 
test.cc
// complie in a chromebook linux

#include "matplotlibcpp.h"
#include <vector>

namespace plt = matplotlibcpp;

int main() {
  std::vector<double> y = {1, 3, 2, 4};
  plt::plot(y);
  plt::savefig("minimal.pdf");
  plt::show();
}

Reference: 
https://matplotlib-cpp.readthedocs.io/en/latest/examples.html 
http://hilite.me/