Python matplotlib gives very nice figures. How to call python matplotlib in Qt C++ project? I'd like to put those figures in Qt dialogs and data are transferred via memory.
You can create a python script with function calls to matplotlib and add them as callback functions in your C++ code.
This tutorial explains how this can be done.
I also recommend reading the documentation on Python.h.
I would try using matplotlib-cpp. It is built to resemble the plotting API used by Matlab and matplotlib. Basically it is a C++ wrapper around matplotlib and it's header only. Keep in mind though that it does not provide all the matplotlib features from python.
Here is the initial example from GitHub:
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
plt::plot({1,3,2,4});
plt::show();
}
Compile
g++ minimal.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With