From d89878b950e2587fee24c943a61944bf254d509c Mon Sep 17 00:00:00 2001 From: Tobias Tschirch Date: Mon, 11 Mar 2019 22:39:05 +0100 Subject: [PATCH 01/86] Add fill plot with example --- Makefile | 10 ++++++++-- examples/fill.cpp | 35 +++++++++++++++++++++++++++++++++++ examples/fill.png | Bin 0 -> 62995 bytes matplotlibcpp.h | 37 +++++++++++++++++++++++++++++++++++-- 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 examples/fill.cpp create mode 100644 examples/fill.png diff --git a/Makefile b/Makefile index 3c4ac36..50a7af8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -examples: minimal basic modern animation nonblock xkcd quiver bar surface +examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill minimal: examples/minimal.cpp matplotlibcpp.h cd examples && g++ -DWITHOUT_NUMPY minimal.cpp -I/usr/include/python2.7 -lpython2.7 -o minimal -std=c++11 @@ -27,5 +27,11 @@ bar: examples/bar.cpp matplotlibcpp.h surface: examples/surface.cpp matplotlibcpp.h cd examples && g++ surface.cpp -I/usr/include/python2.7 -lpython2.7 -o surface -std=c++11 +fill_inbetween: examples/fill_inbetween.cpp matplotlibcpp.h + cd examples && g++ fill_inbetween.cpp -I/usr/include/python2.7 -lpython2.7 -o fill_inbetween -std=c++11 + +fill: examples/fill.cpp matplotlibcpp.h + cd examples && g++ fill.cpp -I/usr/include/python2.7 -lpython2.7 -o fill -std=c++11 + clean: - rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar} + rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill} diff --git a/examples/fill.cpp b/examples/fill.cpp new file mode 100644 index 0000000..6059b47 --- /dev/null +++ b/examples/fill.cpp @@ -0,0 +1,35 @@ +#define _USE_MATH_DEFINES +#include "../matplotlibcpp.h" +#include + +using namespace std; +namespace plt = matplotlibcpp; + +// Example fill plot taken from: +// https://matplotlib.org/gallery/misc/fill_spiral.html +int main() { + // Prepare data. + vector theta; + for (double d = 0; d < 8 * M_PI; d += 0.1) + theta.push_back(d); + + const int a = 1; + const double b = 0.2; + + for (double dt = 0; dt < 2 * M_PI; dt += M_PI/2.0) { + vector x1, y1, x2, y2; + for (double th : theta) { + x1.push_back( a*cos(th + dt) * exp(b*th) ); + y1.push_back( a*sin(th + dt) * exp(b*th) ); + + x2.push_back( a*cos(th + dt + M_PI/4.0) * exp(b*th) ); + y2.push_back( a*sin(th + dt + M_PI/4.0) * exp(b*th) ); + } + + x1.insert(x1.end(), x2.rbegin(), x2.rend()); + y1.insert(y1.end(), y2.rbegin(), y2.rend()); + + plt::fill(x1, y1, {}); + } + plt::show(); +} diff --git a/examples/fill.png b/examples/fill.png new file mode 100644 index 0000000000000000000000000000000000000000..aa1fc0db3665bb4e38800974b85b238318851341 GIT binary patch literal 62995 zcmeFYWm{F@7B)&rNDI;-BGTR6AdPf)!=k&D7NkR3y1Tnmx;v#|(Yc5-*=M`YA2=W0 z4=>jxvF3En@jN5%dyFScQC<@DEx}tTC@55^FJekiP%!>bP|zEQ@W3bRlPiCLA8<}0 zQYwhRmp7tGDDXFu{TEFqC@6Hp*MHE3f(4eqhuqHM8qUggX3lPgj;2r`LuY#%J7*h9 zqYtj8j!u?#wjWp+m>HPqK3F(A+w(9o{(m;@P#MU3I#nso2e5{w%RE;V6@Es8x2D`FN2|j;M^Z`wWilLo~YU>W>2O>*++bv0u z(%U?*Q;wn2C}essiY89WjN2m@eM=F?aabZQg|W6hZl3TyBVk0cKn#&al(sqO|NMsN zA_YSQe1f=X^a&bU1o+IJITq^ee{RB)f(inzkm*Ex@_)U8!65NY==BOBE;-Wg*DHbH zF>s2nSGxPY{NKm?pS?E@(>ze-W*n(QgM*#pLrA0WQP%US<+AHFVOGsCF1w21>YT2bO6sX&+rINW;JK=d2mi-)R(ukq~=_) zhy5Hkw6^)5MOh5X9YHaOzdS!3tarR{uN$)wghfQ~ZCAX1|DM@$>Qlaax^$+157gae z2x;igpQ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)oR^-kA literal 0 HcmV?d00001 diff --git a/matplotlibcpp.h b/matplotlibcpp.h index db636f8..4034f4f 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -39,6 +39,7 @@ struct _interpreter { PyObject *s_python_function_semilogx; PyObject *s_python_function_semilogy; PyObject *s_python_function_loglog; + PyObject *s_python_function_fill; PyObject *s_python_function_fill_between; PyObject *s_python_function_hist; PyObject *s_python_function_scatter; @@ -155,6 +156,7 @@ struct _interpreter { s_python_function_semilogx = PyObject_GetAttrString(pymod, "semilogx"); s_python_function_semilogy = PyObject_GetAttrString(pymod, "semilogy"); s_python_function_loglog = PyObject_GetAttrString(pymod, "loglog"); + s_python_function_fill = PyObject_GetAttrString(pymod, "fill"); s_python_function_fill_between = PyObject_GetAttrString(pymod, "fill_between"); s_python_function_hist = PyObject_GetAttrString(pymod,"hist"); s_python_function_scatter = PyObject_GetAttrString(pymod,"scatter"); @@ -194,6 +196,7 @@ struct _interpreter { || !s_python_function_semilogx || !s_python_function_semilogy || !s_python_function_loglog + || !s_python_function_fill || !s_python_function_fill_between || !s_python_function_subplot || !s_python_function_legend @@ -231,6 +234,7 @@ struct _interpreter { || !PyFunction_Check(s_python_function_semilogx) || !PyFunction_Check(s_python_function_semilogy) || !PyFunction_Check(s_python_function_loglog) + || !PyFunction_Check(s_python_function_fill) || !PyFunction_Check(s_python_function_fill_between) || !PyFunction_Check(s_python_function_subplot) || !PyFunction_Check(s_python_function_legend) @@ -523,6 +527,36 @@ bool stem(const std::vector &x, const std::vector &y, const st return res; } +template< typename Numeric > +bool fill(const std::vector& x, const std::vector& y, const std::map& keywords) +{ + assert(x.size() == y.size()); + + // using numpy arrays + PyObject* xarray = get_array(x); + PyObject* yarray = get_array(y); + + // construct positional args + PyObject* args = PyTuple_New(2); + PyTuple_SetItem(args, 0, xarray); + PyTuple_SetItem(args, 1, yarray); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_fill, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + + if (res) Py_DECREF(res); + + return res; +} + template< typename Numeric > bool fill_between(const std::vector& x, const std::vector& y1, const std::vector& y2, const std::map& keywords) { @@ -542,8 +576,7 @@ bool fill_between(const std::vector& x, const std::vector& y1, // construct keyword args PyObject* kwargs = PyDict_New(); - for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) - { + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); } From d42a969cc10978a5e4490d50a51e301ce2c5e7d7 Mon Sep 17 00:00:00 2001 From: Patric Schmitz Date: Thu, 24 Jan 2019 16:54:19 +0100 Subject: [PATCH 02/86] Add portability #defines PyLong_FromLong, PyUnicode_FromString --- matplotlibcpp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 4034f4f..356f9f2 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -18,6 +18,8 @@ #if PY_MAJOR_VERSION >= 3 # define PyString_FromString PyUnicode_FromString +# define PyInt_FromLong PyLong_FromLong +# define PyString_FromString PyUnicode_FromString #endif From 05087cf86ea6100a6a723a9b65d97dc90566b497 Mon Sep 17 00:00:00 2001 From: Patric Schmitz Date: Thu, 24 Jan 2019 16:55:11 +0100 Subject: [PATCH 03/86] Additional debug output if python module loading fails --- matplotlibcpp.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 356f9f2..6c145ef 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -122,12 +122,15 @@ struct _interpreter { PyObject* cmname = PyString_FromString("matplotlib.cm"); PyObject* pylabname = PyString_FromString("pylab"); if (!pyplotname || !pylabname || !matplotlibname || !cmname) { - throw std::runtime_error("couldnt create string"); + throw std::runtime_error("couldnt create string"); } PyObject* matplotlib = PyImport_Import(matplotlibname); Py_DECREF(matplotlibname); - if (!matplotlib) { throw std::runtime_error("Error loading module matplotlib!"); } + if (!matplotlib) { + PyErr_Print(); + throw std::runtime_error("Error loading module matplotlib!"); + } // matplotlib.use() must be called *before* pylab, matplotlib.pyplot, // or matplotlib.backends is imported for the first time From d184e14673541ff9bae42331cd1cc8a03e2e63c9 Mon Sep 17 00:00:00 2001 From: Patric Schmitz Date: Thu, 24 Jan 2019 16:55:40 +0100 Subject: [PATCH 04/86] Add cumulative parameter to hist() --- matplotlibcpp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 6c145ef..826854b 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -595,7 +595,8 @@ bool fill_between(const std::vector& x, const std::vector& y1, } template< typename Numeric> -bool hist(const std::vector& y, long bins=10,std::string color="b", double alpha=1.0) +bool hist(const std::vector& y, long bins=10,std::string color="b", + double alpha=1.0, bool cumulative=false) { PyObject* yarray = get_array(y); @@ -604,6 +605,7 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", dou PyDict_SetItemString(kwargs, "bins", PyLong_FromLong(bins)); PyDict_SetItemString(kwargs, "color", PyString_FromString(color.c_str())); PyDict_SetItemString(kwargs, "alpha", PyFloat_FromDouble(alpha)); + PyDict_SetItemString(kwargs, "cumulative", cumulative ? Py_True : Py_False); PyObject* plot_args = PyTuple_New(1); From f64f1f6583e468abf2871b3137e9012a80162357 Mon Sep 17 00:00:00 2001 From: Paul Jurczak Date: Wed, 13 Mar 2019 01:21:03 -0600 Subject: [PATCH 05/86] Added missing header VS2017 failed to compile due to missing `#include ` --- matplotlibcpp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 826854b..ff722c2 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -2,6 +2,7 @@ #include #include +#include #include #include #include From 8babc98e0f3d1b33008e827f8b9267a1bd65c470 Mon Sep 17 00:00:00 2001 From: William Lee Date: Wed, 20 Mar 2019 10:36:47 +0800 Subject: [PATCH 06/86] Add kwargs for title, xlabel, ylabel --- matplotlibcpp.h | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index ff722c2..431ba3a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1321,29 +1321,41 @@ inline void subplot(long nrows, long ncols, long plot_number) Py_DECREF(res); } -inline void title(const std::string &titlestr) +inline void title(const std::string &titlestr, const std::map &keywords = {}) { PyObject* pytitlestr = PyString_FromString(titlestr.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pytitlestr); - PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_title, args); + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_title, args, kwargs); if(!res) throw std::runtime_error("Call to title() failed."); Py_DECREF(args); + Py_DECREF(kwargs); Py_DECREF(res); } -inline void suptitle(const std::string &suptitlestr) +inline void suptitle(const std::string &suptitlestr, const std::map &keywords = {}) { PyObject* pysuptitlestr = PyString_FromString(suptitlestr.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pysuptitlestr); - PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_suptitle, args); + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_suptitle, args, kwargs); if(!res) throw std::runtime_error("Call to suptitle() failed."); Py_DECREF(args); + Py_DECREF(kwargs); Py_DECREF(res); } @@ -1360,29 +1372,41 @@ inline void axis(const std::string &axisstr) Py_DECREF(res); } -inline void xlabel(const std::string &str) +inline void xlabel(const std::string &str, const std::map &keywords = {}) { PyObject* pystr = PyString_FromString(str.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pystr); - PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_xlabel, args); + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_xlabel, args, kwargs); if(!res) throw std::runtime_error("Call to xlabel() failed."); Py_DECREF(args); + Py_DECREF(kwargs); Py_DECREF(res); } -inline void ylabel(const std::string &str) +inline void ylabel(const std::string &str, const std::map& keywords = {}) { PyObject* pystr = PyString_FromString(str.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pystr); - PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_ylabel, args); + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_ylabel, args, kwargs); if(!res) throw std::runtime_error("Call to ylabel() failed."); Py_DECREF(args); + Py_DECREF(kwargs); Py_DECREF(res); } From 07a73fad22b185de42844dd110da7eb14197b833 Mon Sep 17 00:00:00 2001 From: Olivier Kermorgant Date: Wed, 13 Mar 2019 18:21:31 +0100 Subject: [PATCH 07/86] Add dynamic plot class --- Makefile | 7 ++- examples/update.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++++ matplotlibcpp.h | 104 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 examples/update.cpp diff --git a/Makefile b/Makefile index 50a7af8..1df85e6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill +examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill update minimal: examples/minimal.cpp matplotlibcpp.h cd examples && g++ -DWITHOUT_NUMPY minimal.cpp -I/usr/include/python2.7 -lpython2.7 -o minimal -std=c++11 @@ -32,6 +32,9 @@ fill_inbetween: examples/fill_inbetween.cpp matplotlibcpp.h fill: examples/fill.cpp matplotlibcpp.h cd examples && g++ fill.cpp -I/usr/include/python2.7 -lpython2.7 -o fill -std=c++11 + +update: examples/update.cpp matplotlibcpp.h + cd examples && g++ update.cpp -I/usr/include/python2.7 -lpython2.7 -o update -std=c++11 clean: - rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill} + rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill,update} diff --git a/examples/update.cpp b/examples/update.cpp new file mode 100644 index 0000000..7027ba4 --- /dev/null +++ b/examples/update.cpp @@ -0,0 +1,112 @@ +#define _USE_MATH_DEFINES +#include +#include "../matplotlibcpp.h" +#include + +namespace plt = matplotlibcpp; + +void update_window(const double x, const double y, const double t, + std::vector &xt, std::vector &yt) +{ + const double target_length = 300; + const double half_win = (target_length/(2.*sqrt(1.+t*t))); + + xt[0] = x - half_win; + xt[1] = x + half_win; + yt[0] = y - half_win*t; + yt[1] = y + half_win*t; +} + + +int main() +{ + + bool use_dynamic_plot = false; + bool timeit = true; + + size_t n = 1000; + std::vector x, y; + + const double w = 0.05; + const double a = n/2; + + for(size_t i=0; i xt(2), yt(2); + + plt::title("Sample figure"); + + std::chrono::time_point start, end; + start = std::chrono::system_clock::now(); + + if(use_dynamic_plot) + { + plt::xlim(x.front(), x.back()); + plt::ylim(-a,a); + plt::axis("equal"); + + // plot sin once and for all + plt::named_plot("sin", x, y); + + // prepare plotting the tangent + plt::Plot plot("tangent"); + + plt::legend(); + + for(size_t i=0; i + (end-start).count(); + if(use_dynamic_plot) + std::cout << "dynamic"; + else + std::cout << "static"; + + std::cout << " : " << elapsed_seconds/1000 << " ms\n"; +} diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 431ba3a..2797295 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1439,7 +1439,7 @@ inline void show(const bool block = true) PyObject *kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "block", Py_False); res = PyObject_Call( detail::_interpreter::get().s_python_function_show, detail::_interpreter::get().s_python_empty_tuple, kwargs); - Py_DECREF(kwargs); + Py_DECREF(kwargs); } @@ -1706,4 +1706,106 @@ inline bool plot(const std::vector& x, const std::vector& y, con return plot(x,y,keywords); } +/* + * This class allows dynamic plots, ie changing the plotted data without clearing and re-plotting + */ + +class Plot +{ +public: + // default initialization with plot label, some data and format + template + Plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + + assert(x.size() == y.size()); + + PyObject* kwargs = PyDict_New(); + if(name != "") + PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); + + PyObject* xarray = get_array(x); + PyObject* yarray = get_array(y); + + PyObject* pystring = PyString_FromString(format.c_str()); + + PyObject* plot_args = PyTuple_New(3); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + PyTuple_SetItem(plot_args, 2, pystring); + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_plot, plot_args, kwargs); + + Py_DECREF(kwargs); + Py_DECREF(plot_args); + + if(res) + { + line= PyList_GetItem(res, 0); + + if(line) + set_data_fct = PyObject_GetAttrString(line,"set_data"); + else + Py_DECREF(line); + Py_DECREF(res); + } + } + + // shorter initialization with name or format only + // basically calls line, = plot([], []) + Plot(const std::string& name = "", const std::string& format = "") + : Plot(name, std::vector(), std::vector(), format) {} + + template + bool update(const std::vector& x, const std::vector& y) { + assert(x.size() == y.size()); + if(set_data_fct) + { + PyObject* xarray = get_array(x); + PyObject* yarray = get_array(y); + + PyObject* plot_args = PyTuple_New(2); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + + PyObject* res = PyObject_CallObject(set_data_fct, plot_args); + if (res) Py_DECREF(res); + return res; + } + return false; + } + + // clears the plot but keep it available + bool clear() { + return update(std::vector(), std::vector()); + } + + // definitely remove this line + void remove() { + if(line) + { + auto remove_fct = PyObject_GetAttrString(line,"remove"); + PyObject* args = PyTuple_New(0); + PyObject* res = PyObject_CallObject(remove_fct, args); + if (res) Py_DECREF(res); + } + decref(); + } + + ~Plot() { + decref(); + } +private: + + void decref() { + if(line) + Py_DECREF(line); + if(set_data_fct) + Py_DECREF(set_data_fct); + } + + + PyObject* line = nullptr; + PyObject* set_data_fct = nullptr; +}; + } // end namespace matplotlibcpp From c48ed308d1065464365a9287a8dadeacb2fd2c4b Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sun, 7 Apr 2019 12:39:03 +0200 Subject: [PATCH 08/86] Reduced example for dynamic plot class. Removed timing and comparison code paths from the example for the dynamic plot class, to make it easier to spot the essential usage to the casual reader. --- examples/update.cpp | 88 ++++++++++----------------------------------- 1 file changed, 18 insertions(+), 70 deletions(-) diff --git a/examples/update.cpp b/examples/update.cpp index 7027ba4..4b7be46 100644 --- a/examples/update.cpp +++ b/examples/update.cpp @@ -20,93 +20,41 @@ void update_window(const double x, const double y, const double t, int main() { - - bool use_dynamic_plot = false; - bool timeit = true; - size_t n = 1000; std::vector x, y; const double w = 0.05; const double a = n/2; - for(size_t i=0; i xt(2), yt(2); - plt::title("Sample figure"); - - std::chrono::time_point start, end; - start = std::chrono::system_clock::now(); - - if(use_dynamic_plot) - { - plt::xlim(x.front(), x.back()); - plt::ylim(-a,a); - plt::axis("equal"); - - // plot sin once and for all - plt::named_plot("sin", x, y); - - // prepare plotting the tangent - plt::Plot plot("tangent"); - - plt::legend(); - - for(size_t i=0; i - (end-start).count(); - if(use_dynamic_plot) - std::cout << "dynamic"; - else - std::cout << "static"; - - std::cout << " : " << elapsed_seconds/1000 << " ms\n"; + } } From 94c0215d6aa87c6b394ab2990e958dfe57c0d001 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Mon, 8 Apr 2019 11:38:01 +0200 Subject: [PATCH 09/86] Fixed type in update example. --- examples/update.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/update.cpp b/examples/update.cpp index 4b7be46..64f4906 100644 --- a/examples/update.cpp +++ b/examples/update.cpp @@ -33,7 +33,7 @@ int main() std::vector xt(2), yt(2); - plt::title("Tangent of a since curve"); + plt::title("Tangent of a sine curve"); plt::xlim(x.front(), x.back()); plt::ylim(-a, a); plt::axis("equal"); From 4ace1ad946e2782cac0539be96cee6ec5e9d8ba8 Mon Sep 17 00:00:00 2001 From: jul Date: Thu, 30 May 2019 21:10:19 +0200 Subject: [PATCH 10/86] fix the figsize segfault bug plt::figure_size is known to sometimes cause segfaults if called without a preceding plt::figure as suggested in the issues this is fixed by calling detail::_interpreter::get() at the beginning of the function --- matplotlibcpp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 2797295..30b21ee 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1116,6 +1116,9 @@ inline bool fignum_exists(long number) inline void figure_size(size_t w, size_t h) { + // Make sure interpreter is initialised + detail::_interpreter::get(); + const size_t dpi = 100; PyObject* size = PyTuple_New(2); PyTuple_SetItem(size, 0, PyFloat_FromDouble((double)w / dpi)); From 019cd237a6be26df33aa1a7efa77dfba171d4fc0 Mon Sep 17 00:00:00 2001 From: Trevor Keller Date: Sun, 12 May 2019 12:35:33 -0400 Subject: [PATCH 11/86] check functions with narrower error message scope --- matplotlibcpp.h | 165 +++++++++++++++--------------------------------- 1 file changed, 51 insertions(+), 114 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 30b21ee..8194ec8 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -84,6 +84,18 @@ struct _interpreter { return ctx; } + PyObject* safe_import(PyObject* module, std::string fname) { + PyObject* fn = PyObject_GetAttrString(module, fname.c_str()); + + if (!fn) + throw std::runtime_error(std::string("Couldn't find required function: ") + fname); + + if (!PyFunction_Check(fn)) + throw std::runtime_error(fname + std::string(" is unexpectedly not a PyFunction.")); + + return fn; + } + private: #ifndef WITHOUT_NUMPY @@ -151,120 +163,45 @@ struct _interpreter { Py_DECREF(pylabname); if (!pylabmod) { throw std::runtime_error("Error loading module pylab!"); } - s_python_function_show = PyObject_GetAttrString(pymod, "show"); - s_python_function_close = PyObject_GetAttrString(pymod, "close"); - s_python_function_draw = PyObject_GetAttrString(pymod, "draw"); - s_python_function_pause = PyObject_GetAttrString(pymod, "pause"); - s_python_function_figure = PyObject_GetAttrString(pymod, "figure"); - s_python_function_fignum_exists = PyObject_GetAttrString(pymod, "fignum_exists"); - s_python_function_plot = PyObject_GetAttrString(pymod, "plot"); - s_python_function_quiver = PyObject_GetAttrString(pymod, "quiver"); - s_python_function_semilogx = PyObject_GetAttrString(pymod, "semilogx"); - s_python_function_semilogy = PyObject_GetAttrString(pymod, "semilogy"); - s_python_function_loglog = PyObject_GetAttrString(pymod, "loglog"); - s_python_function_fill = PyObject_GetAttrString(pymod, "fill"); - s_python_function_fill_between = PyObject_GetAttrString(pymod, "fill_between"); - s_python_function_hist = PyObject_GetAttrString(pymod,"hist"); - s_python_function_scatter = PyObject_GetAttrString(pymod,"scatter"); - s_python_function_subplot = PyObject_GetAttrString(pymod, "subplot"); - s_python_function_legend = PyObject_GetAttrString(pymod, "legend"); - s_python_function_ylim = PyObject_GetAttrString(pymod, "ylim"); - s_python_function_title = PyObject_GetAttrString(pymod, "title"); - s_python_function_axis = PyObject_GetAttrString(pymod, "axis"); - s_python_function_xlabel = PyObject_GetAttrString(pymod, "xlabel"); - s_python_function_ylabel = PyObject_GetAttrString(pymod, "ylabel"); - s_python_function_xticks = PyObject_GetAttrString(pymod, "xticks"); - s_python_function_yticks = PyObject_GetAttrString(pymod, "yticks"); - s_python_function_grid = PyObject_GetAttrString(pymod, "grid"); - s_python_function_xlim = PyObject_GetAttrString(pymod, "xlim"); - s_python_function_ion = PyObject_GetAttrString(pymod, "ion"); - s_python_function_ginput = PyObject_GetAttrString(pymod, "ginput"); - s_python_function_save = PyObject_GetAttrString(pylabmod, "savefig"); - s_python_function_annotate = PyObject_GetAttrString(pymod,"annotate"); - s_python_function_clf = PyObject_GetAttrString(pymod, "clf"); - s_python_function_errorbar = PyObject_GetAttrString(pymod, "errorbar"); - s_python_function_tight_layout = PyObject_GetAttrString(pymod, "tight_layout"); - s_python_function_stem = PyObject_GetAttrString(pymod, "stem"); - s_python_function_xkcd = PyObject_GetAttrString(pymod, "xkcd"); - s_python_function_text = PyObject_GetAttrString(pymod, "text"); - s_python_function_suptitle = PyObject_GetAttrString(pymod, "suptitle"); - s_python_function_bar = PyObject_GetAttrString(pymod,"bar"); - s_python_function_subplots_adjust = PyObject_GetAttrString(pymod,"subplots_adjust"); - - if( !s_python_function_show - || !s_python_function_close - || !s_python_function_draw - || !s_python_function_pause - || !s_python_function_figure - || !s_python_function_fignum_exists - || !s_python_function_plot - || !s_python_function_quiver - || !s_python_function_semilogx - || !s_python_function_semilogy - || !s_python_function_loglog - || !s_python_function_fill - || !s_python_function_fill_between - || !s_python_function_subplot - || !s_python_function_legend - || !s_python_function_ylim - || !s_python_function_title - || !s_python_function_axis - || !s_python_function_xlabel - || !s_python_function_ylabel - || !s_python_function_grid - || !s_python_function_xlim - || !s_python_function_ion - || !s_python_function_ginput - || !s_python_function_save - || !s_python_function_clf - || !s_python_function_annotate - || !s_python_function_errorbar - || !s_python_function_errorbar - || !s_python_function_tight_layout - || !s_python_function_stem - || !s_python_function_xkcd - || !s_python_function_text - || !s_python_function_suptitle - || !s_python_function_bar - || !s_python_function_subplots_adjust - ) { throw std::runtime_error("Couldn't find required function!"); } - - if ( !PyFunction_Check(s_python_function_show) - || !PyFunction_Check(s_python_function_close) - || !PyFunction_Check(s_python_function_draw) - || !PyFunction_Check(s_python_function_pause) - || !PyFunction_Check(s_python_function_figure) - || !PyFunction_Check(s_python_function_fignum_exists) - || !PyFunction_Check(s_python_function_plot) - || !PyFunction_Check(s_python_function_quiver) - || !PyFunction_Check(s_python_function_semilogx) - || !PyFunction_Check(s_python_function_semilogy) - || !PyFunction_Check(s_python_function_loglog) - || !PyFunction_Check(s_python_function_fill) - || !PyFunction_Check(s_python_function_fill_between) - || !PyFunction_Check(s_python_function_subplot) - || !PyFunction_Check(s_python_function_legend) - || !PyFunction_Check(s_python_function_annotate) - || !PyFunction_Check(s_python_function_ylim) - || !PyFunction_Check(s_python_function_title) - || !PyFunction_Check(s_python_function_axis) - || !PyFunction_Check(s_python_function_xlabel) - || !PyFunction_Check(s_python_function_ylabel) - || !PyFunction_Check(s_python_function_grid) - || !PyFunction_Check(s_python_function_xlim) - || !PyFunction_Check(s_python_function_ion) - || !PyFunction_Check(s_python_function_ginput) - || !PyFunction_Check(s_python_function_save) - || !PyFunction_Check(s_python_function_clf) - || !PyFunction_Check(s_python_function_tight_layout) - || !PyFunction_Check(s_python_function_errorbar) - || !PyFunction_Check(s_python_function_stem) - || !PyFunction_Check(s_python_function_xkcd) - || !PyFunction_Check(s_python_function_text) - || !PyFunction_Check(s_python_function_suptitle) - || !PyFunction_Check(s_python_function_bar) - || !PyFunction_Check(s_python_function_subplots_adjust) - ) { throw std::runtime_error("Python object is unexpectedly not a PyFunction."); } + s_python_function_show = safe_import(pymod, "show"); + s_python_function_close = safe_import(pymod, "close"); + s_python_function_draw = safe_import(pymod, "draw"); + s_python_function_pause = safe_import(pymod, "pause"); + s_python_function_figure = safe_import(pymod, "figure"); + s_python_function_fignum_exists = safe_import(pymod, "fignum_exists"); + s_python_function_plot = safe_import(pymod, "plot"); + s_python_function_quiver = safe_import(pymod, "quiver"); + s_python_function_semilogx = safe_import(pymod, "semilogx"); + s_python_function_semilogy = safe_import(pymod, "semilogy"); + s_python_function_loglog = safe_import(pymod, "loglog"); + s_python_function_fill = safe_import(pymod, "fill"); + s_python_function_fill_between = safe_import(pymod, "fill_between"); + s_python_function_hist = safe_import(pymod,"hist"); + s_python_function_scatter = safe_import(pymod,"scatter"); + s_python_function_subplot = safe_import(pymod, "subplot"); + s_python_function_legend = safe_import(pymod, "legend"); + s_python_function_ylim = safe_import(pymod, "ylim"); + s_python_function_title = safe_import(pymod, "title"); + s_python_function_axis = safe_import(pymod, "axis"); + s_python_function_xlabel = safe_import(pymod, "xlabel"); + s_python_function_ylabel = safe_import(pymod, "ylabel"); + s_python_function_xticks = safe_import(pymod, "xticks"); + s_python_function_yticks = safe_import(pymod, "yticks"); + s_python_function_grid = safe_import(pymod, "grid"); + s_python_function_xlim = safe_import(pymod, "xlim"); + s_python_function_ion = safe_import(pymod, "ion"); + s_python_function_ginput = safe_import(pymod, "ginput"); + s_python_function_save = safe_import(pylabmod, "savefig"); + s_python_function_annotate = safe_import(pymod,"annotate"); + s_python_function_clf = safe_import(pymod, "clf"); + s_python_function_errorbar = safe_import(pymod, "errorbar"); + s_python_function_tight_layout = safe_import(pymod, "tight_layout"); + s_python_function_stem = safe_import(pymod, "stem"); + s_python_function_xkcd = safe_import(pymod, "xkcd"); + s_python_function_text = safe_import(pymod, "text"); + s_python_function_suptitle = safe_import(pymod, "suptitle"); + s_python_function_bar = safe_import(pymod,"bar"); + s_python_function_subplots_adjust = safe_import(pymod,"subplots_adjust"); s_python_empty_tuple = PyTuple_New(0); } From 20e090ef9e1cab8bd28ca629e34538b297a43ffd Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Tue, 6 Nov 2018 12:04:28 +0000 Subject: [PATCH 12/86] Add support for imshow() This PR adds support for the imshow() function to matplotlibcpp. imshow() displays an image in the current figure and allows for setting extra parameters such as the colormap used. I've also added a version of the function which takes an OpenCV matrix as an input (in a separate commit), which provides a nicer interface. This requires OpenCV, but I've made this functionality optional: you have to explicitly define WITH_OPENCV if you want it. --- matplotlibcpp.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 8194ec8..132cc34 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -15,6 +15,10 @@ #ifndef WITHOUT_NUMPY # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION # include + +# ifdef WITH_OPENCV +# include +# endif // WITH_OPENCV #endif // WITHOUT_NUMPY #if PY_MAJOR_VERSION >= 3 @@ -45,6 +49,7 @@ struct _interpreter { PyObject *s_python_function_fill; PyObject *s_python_function_fill_between; PyObject *s_python_function_hist; + PyObject *s_python_function_imshow; PyObject *s_python_function_scatter; PyObject *s_python_function_subplot; PyObject *s_python_function_legend; @@ -202,6 +207,9 @@ struct _interpreter { s_python_function_suptitle = safe_import(pymod, "suptitle"); s_python_function_bar = safe_import(pymod,"bar"); s_python_function_subplots_adjust = safe_import(pymod,"subplots_adjust"); +#ifndef WITHOUT_NUMPY + s_python_function_imshow = safe_import(pymod, "imshow"); +#endif s_python_empty_tuple = PyTuple_New(0); } @@ -560,6 +568,78 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", return res; } +#ifndef WITHOUT_NUMPY + namespace internal { + void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords) + { + assert(type == NPY_UINT8 || type == NPY_FLOAT); + assert(colors == 1 || colors == 3 || colors == 4); + + detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work + + // construct args + npy_intp dims[3] = { rows, columns, colors }; + PyObject *args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyArray_SimpleNewFromData(colors == 1 ? 2 : 3, dims, type, ptr)); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject *res = PyObject_Call(detail::_interpreter::get().s_python_function_imshow, args, kwargs); + Py_DECREF(args); + Py_DECREF(kwargs); + if (!res) + throw std::runtime_error("Call to imshow() failed"); + Py_DECREF(res); + } + } + + void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + { + internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords); + } + + void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + { + internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords); + } + +#ifdef WITH_OPENCV + void imshow(const cv::Mat &image, const std::map &keywords = {}) + { + // Convert underlying type of matrix, if needed + cv::Mat image2; + NPY_TYPES npy_type = NPY_UINT8; + switch (image.type() & CV_MAT_DEPTH_MASK) { + case CV_8U: + image2 = image; + break; + case CV_32F: + image2 = image; + npy_type = NPY_FLOAT; + break; + default: + image.convertTo(image2, CV_MAKETYPE(CV_8U, image.channels())); + } + + // If color image, convert from BGR to RGB + switch (image2.channels()) { + case 3: + cv::cvtColor(image2, image2, CV_BGR2RGB); + break; + case 4: + cv::cvtColor(image2, image2, CV_BGRA2RGBA); + } + + internal::imshow(image2.data, npy_type, image2.rows, image2.cols, image2.channels(), keywords); + } +#endif // WITH_OPENCV +#endif // WITHOUT_NUMPY + template bool scatter(const std::vector& x, const std::vector& y, From bc7e4576b2123bf9851e4e779228e2374ef9862c Mon Sep 17 00:00:00 2001 From: Trevor Keller Date: Wed, 8 May 2019 00:45:29 -0400 Subject: [PATCH 13/86] Added basic example for imshow. This addresses comments on #79. --- Makefile | 9 ++++++--- examples/imshow.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 examples/imshow.cpp diff --git a/Makefile b/Makefile index 1df85e6..f9e5366 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill update +examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill update imshow minimal: examples/minimal.cpp matplotlibcpp.h cd examples && g++ -DWITHOUT_NUMPY minimal.cpp -I/usr/include/python2.7 -lpython2.7 -o minimal -std=c++11 @@ -32,9 +32,12 @@ fill_inbetween: examples/fill_inbetween.cpp matplotlibcpp.h fill: examples/fill.cpp matplotlibcpp.h cd examples && g++ fill.cpp -I/usr/include/python2.7 -lpython2.7 -o fill -std=c++11 - + update: examples/update.cpp matplotlibcpp.h cd examples && g++ update.cpp -I/usr/include/python2.7 -lpython2.7 -o update -std=c++11 +imshow: examples/imshow.cpp matplotlibcpp.h + cd examples && g++ imshow.cpp -I/usr/include/python2.7 -lpython2.7 -o imshow -std=c++11 + clean: - rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill,update} + rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill,update,imshow} diff --git a/examples/imshow.cpp b/examples/imshow.cpp new file mode 100644 index 0000000..b11661e --- /dev/null +++ b/examples/imshow.cpp @@ -0,0 +1,29 @@ +#define _USE_MATH_DEFINES +#include +#include +#include "../matplotlibcpp.h" + +using namespace std; +namespace plt = matplotlibcpp; + +int main() +{ + // Prepare data + int ncols = 500, nrows = 300; + std::vector z(ncols * nrows); + for (int j=0; j Date: Fri, 19 Apr 2019 16:12:57 +0200 Subject: [PATCH 14/86] Add support for plot(y,keywords) There is a convenient function plot(y,format) already, which however doesn't allow to set additional parameters like labels, so add a similar function that supports keywords. --- matplotlibcpp.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 132cc34..e626c4c 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1061,6 +1061,14 @@ bool plot(const std::vector& y, const std::string& format = "") return plot(x,y,format); } +template +bool plot(const std::vector& y, const std::map& keywords) +{ + std::vector x(y.size()); + for(size_t i=0; i bool stem(const std::vector& y, const std::string& format = "") { From 2772217011029f9dee286a77f0d29f6508004bf0 Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Sun, 28 Jul 2019 13:21:58 +0100 Subject: [PATCH 15/86] Fix for OpenCV 4 In the latest version of OpenCV, several constants were removed in favour of enum classes. Fix by #define'ing the ones we need. --- matplotlibcpp.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index e626c4c..ae78c98 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -17,8 +17,17 @@ # include # ifdef WITH_OPENCV -# include +# include # endif // WITH_OPENCV + +/* + * A bunch of constants were removed in OpenCV 4 in favour of enum classes, so + * define the ones we need here. + */ +# if CV_MAJOR_VERSION > 3 +# define CV_BGR2RGB cv::COLOR_BGR2RGB +# define CV_BGRA2RGBA cv::COLOR_BGRA2RGBA +# endif #endif // WITHOUT_NUMPY #if PY_MAJOR_VERSION >= 3 From 7fa134ea1514a4181ddcd3f0e897490c8fabdbeb Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Mon, 22 Jul 2019 11:29:59 +0200 Subject: [PATCH 16/86] Fixes compiler warnings --- matplotlibcpp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index ae78c98..16e94f0 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -677,12 +677,12 @@ bool scatter(const std::vector& x, template< typename Numeric> bool bar(const std::vector& y, std::string ec = "black", std::string ls = "-", double lw = 1.0, - const std::map& keywords = {}) + __attribute__((unused)) const std::map& keywords = {}) { PyObject* yarray = get_array(y); std::vector x; - for (int i = 0; i < y.size(); i++) + for (std::size_t i = 0; i < y.size(); i++) x.push_back(i); PyObject* xarray = get_array(x); From f4ad842e70cc56a38f3e4cd852968c7c1cecc9a7 Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Tue, 23 Jul 2019 00:02:17 +0200 Subject: [PATCH 17/86] Implements bar slightly more closely to matplotlib --- matplotlibcpp.h | 65 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 16e94f0..6a428d4 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -675,35 +675,56 @@ bool scatter(const std::vector& x, return res; } -template< typename Numeric> -bool bar(const std::vector& y, std::string ec = "black", std::string ls = "-", double lw = 1.0, - __attribute__((unused)) const std::map& keywords = {}) -{ - PyObject* yarray = get_array(y); - - std::vector x; - for (std::size_t i = 0; i < y.size(); i++) - x.push_back(i); +template +bool bar(const std::vector & x, + const std::vector & y, + std::string ec = "black", + std::string ls = "-", + double lw = 1.0, + const std::map & keywords = {}) { + PyObject * xarray = get_array(x); + PyObject * yarray = get_array(y); + + PyObject * kwargs = PyDict_New(); + + PyDict_SetItemString(kwargs, "ec", PyString_FromString(ec.c_str())); + PyDict_SetItemString(kwargs, "ls", PyString_FromString(ls.c_str())); + PyDict_SetItemString(kwargs, "lw", PyFloat_FromDouble(lw)); + + for (std::map::const_iterator it = + keywords.begin(); + it != keywords.end(); + ++it) { + PyDict_SetItemString( + kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } - PyObject* xarray = get_array(x); + PyObject * plot_args = PyTuple_New(2); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); - PyObject* kwargs = PyDict_New(); + PyObject * res = PyObject_Call( + detail::_interpreter::get().s_python_function_bar, plot_args, kwargs); - PyDict_SetItemString(kwargs, "ec", PyString_FromString(ec.c_str())); - PyDict_SetItemString(kwargs, "ls", PyString_FromString(ls.c_str())); - PyDict_SetItemString(kwargs, "lw", PyFloat_FromDouble(lw)); + Py_DECREF(plot_args); + Py_DECREF(kwargs); + if (res) Py_DECREF(res); - PyObject* plot_args = PyTuple_New(2); - PyTuple_SetItem(plot_args, 0, xarray); - PyTuple_SetItem(plot_args, 1, yarray); + return res; +} - PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_bar, plot_args, kwargs); +template +bool bar(const std::vector & y, + std::string ec = "black", + std::string ls = "-", + double lw = 1.0, + const std::map & keywords = {}) { + using T = typename std::remove_reference::type::value_type; - Py_DECREF(plot_args); - Py_DECREF(kwargs); - if(res) Py_DECREF(res); + std::vector x; + for (std::size_t i = 0; i < y.size(); i++) { x.push_back(i); } - return res; + return bar(x, y, ec, ls, lw, keywords); } inline bool subplots_adjust(const std::map& keywords = {}) From d3137c53b16419b80a2aa35fe2f20d36b77d75f3 Mon Sep 17 00:00:00 2001 From: pm-twice <47174886+pm-twice@users.noreply.github.com> Date: Wed, 25 Sep 2019 22:59:14 +0900 Subject: [PATCH 18/86] Fix for imshow multiple definition error #48 When multiple files include matplotlibcpp.h and another file load these files in the same time, compile error of multiple definition in imshow occurs. This fix add inline modifier to imshow(). --- matplotlibcpp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 6a428d4..93f19c8 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -579,7 +579,7 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", #ifndef WITHOUT_NUMPY namespace internal { - void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords) + inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords) { assert(type == NPY_UINT8 || type == NPY_FLOAT); assert(colors == 1 || colors == 3 || colors == 4); @@ -607,12 +607,12 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", } } - void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) { internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords); } - void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) { internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords); } From dbe8e4c63b2b82d3103d9d4854001334047717af Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Sun, 28 Jul 2019 12:58:29 +0100 Subject: [PATCH 19/86] Makefile: Better numpy handling and make building more generic Changes: * Use system version of python by default (overridable with PYTHON_BIN) * Find where numpy headers live on system * Remove boilerplate from Makefile and just build all examples/*.cpp files with appropriate flags --- Makefile | 52 +++++++++++++++++--------------------------------- numpy_flags.py | 12 ++++++++++++ 2 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 numpy_flags.py diff --git a/Makefile b/Makefile index f9e5366..a251d64 100644 --- a/Makefile +++ b/Makefile @@ -1,43 +1,25 @@ -examples: minimal basic modern animation nonblock xkcd quiver bar surface fill_inbetween fill update imshow -minimal: examples/minimal.cpp matplotlibcpp.h - cd examples && g++ -DWITHOUT_NUMPY minimal.cpp -I/usr/include/python2.7 -lpython2.7 -o minimal -std=c++11 +# Use C++11 +CXXFLAGS += -std=c++11 -basic: examples/basic.cpp matplotlibcpp.h - cd examples && g++ basic.cpp -I/usr/include/python2.7 -lpython2.7 -o basic -std=c++11 +# Default to using system's default version of python +PYTHON_BIN ?= python +PYTHON_CONFIG := $(PYTHON_BIN)-config +PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes) +CXXFLAGS += $(PYTHON_INCLUDE) +LDFLAGS += $(shell $(PYTHON_CONFIG) --libs) -modern: examples/modern.cpp matplotlibcpp.h - cd examples && g++ modern.cpp -I/usr/include/python2.7 -lpython2.7 -o modern -std=c++11 +# Either finds numpy or set -DWITHOUT_NUMPY +CURRENT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +CXXFLAGS += $(shell $(PYTHON_BIN) $(CURRENT_DIR)/numpy_flags.py) -animation: examples/animation.cpp matplotlibcpp.h - cd examples && g++ animation.cpp -I/usr/include/python2.7 -lpython2.7 -o animation -std=c++11 +# Assume every *.cpp file is a separate example +SOURCES ?= $(wildcard examples/*.cpp) +EXECUTABLES := $(foreach exec,$(basename $(SOURCES)),$(exec)) -nonblock: examples/nonblock.cpp matplotlibcpp.h - cd examples && g++ nonblock.cpp -I/usr/include/python2.7 -lpython2.7 -o nonblock -std=c++11 +.PHONY: examples -quiver: examples/quiver.cpp matplotlibcpp.h - cd examples && g++ quiver.cpp -I/usr/include/python2.7 -lpython2.7 -o quiver -std=c++11 - -xkcd: examples/xkcd.cpp matplotlibcpp.h - cd examples && g++ xkcd.cpp -I/usr/include/python2.7 -lpython2.7 -o xkcd -std=c++11 - -bar: examples/bar.cpp matplotlibcpp.h - cd examples && g++ bar.cpp -I/usr/include/python2.7 -lpython2.7 -o bar -std=c++11 - -surface: examples/surface.cpp matplotlibcpp.h - cd examples && g++ surface.cpp -I/usr/include/python2.7 -lpython2.7 -o surface -std=c++11 - -fill_inbetween: examples/fill_inbetween.cpp matplotlibcpp.h - cd examples && g++ fill_inbetween.cpp -I/usr/include/python2.7 -lpython2.7 -o fill_inbetween -std=c++11 - -fill: examples/fill.cpp matplotlibcpp.h - cd examples && g++ fill.cpp -I/usr/include/python2.7 -lpython2.7 -o fill -std=c++11 - -update: examples/update.cpp matplotlibcpp.h - cd examples && g++ update.cpp -I/usr/include/python2.7 -lpython2.7 -o update -std=c++11 - -imshow: examples/imshow.cpp matplotlibcpp.h - cd examples && g++ imshow.cpp -I/usr/include/python2.7 -lpython2.7 -o imshow -std=c++11 +examples: $(EXECUTABLES) clean: - rm -f examples/{minimal,basic,modern,animation,nonblock,xkcd,quiver,bar,surface,fill_inbetween,fill,update,imshow} + rm -f ${EXECUTABLES} diff --git a/numpy_flags.py b/numpy_flags.py new file mode 100644 index 0000000..56fd95c --- /dev/null +++ b/numpy_flags.py @@ -0,0 +1,12 @@ +from os import path + +try: + from numpy import __file__ as numpyloc + + # Get numpy directory + numpy_dir = path.dirname(numpyloc) + + # Print the result of joining this to core and include + print("-I" + path.join(numpy_dir, "core", "include")) +except: + print("-DWITHOUT_NUMPY") From 1c2a51f50b72e8b400f2353cd8cc512efae0df74 Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Sun, 28 Jul 2019 13:01:58 +0100 Subject: [PATCH 20/86] Add .gitignore file for example binaries --- examples/.gitignore | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/.gitignore diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000..3da8ad6 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,14 @@ +animation +bar +basic +fill +fill_inbetween +imshow +minimal +modern +nonblock +quiver +subplot +surface +update +xkcd From 6ec72daa6b5ba4e396bee3fdc562f89b9fda2744 Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Sun, 28 Jul 2019 13:30:09 +0100 Subject: [PATCH 21/86] Fix: Allow for building examples individually You don't necessarily want to build all of them. Now you can do, e.g.: make examples/minimal --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index a251d64..15c9f69 100644 --- a/Makefile +++ b/Makefile @@ -21,5 +21,8 @@ EXECUTABLES := $(foreach exec,$(basename $(SOURCES)),$(exec)) examples: $(EXECUTABLES) +$(EXECUTABLES): %: %.cpp + $(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS) + clean: rm -f ${EXECUTABLES} From 1ac91f7593630cfd76a400b8531986c9d7d6f6b4 Mon Sep 17 00:00:00 2001 From: Trevor Keller Date: Sun, 12 May 2019 00:45:55 -0400 Subject: [PATCH 22/86] subplot2grid implementation and example --- examples/subplot2grid.cpp | 44 +++++++++++++++++++++++++++++++++++++++ matplotlibcpp.h | 33 ++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 examples/subplot2grid.cpp diff --git a/examples/subplot2grid.cpp b/examples/subplot2grid.cpp new file mode 100644 index 0000000..f590e51 --- /dev/null +++ b/examples/subplot2grid.cpp @@ -0,0 +1,44 @@ +#define _USE_MATH_DEFINES +#include +#include "../matplotlibcpp.h" + +using namespace std; +namespace plt = matplotlibcpp; + +int main() +{ + // Prepare data + int n = 500; + std::vector x(n), u(n), v(n), w(n); + for(int i=0; i &x, const std::vector &y, const st return res; } +// TODO - it should be possible to make this work by implementing +// a non-numpy alternative for `get_2darray()`. +#ifndef WITHOUT_NUMPY template void plot_surface(const std::vector<::std::vector> &x, const std::vector<::std::vector> &y, @@ -453,6 +458,8 @@ void plot_surface(const std::vector<::std::vector> &x, Py_DECREF(kwargs); if (res) Py_DECREF(res); } +#endif // WITHOUT_NUMPY + template bool stem(const std::vector &x, const std::vector &y, const std::map& keywords) @@ -1073,7 +1080,6 @@ bool named_loglog(const std::string& name, const std::vector& x, const PyTuple_SetItem(plot_args, 0, xarray); PyTuple_SetItem(plot_args, 1, yarray); PyTuple_SetItem(plot_args, 2, pystring); - PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_loglog, plot_args, kwargs); Py_DECREF(kwargs); @@ -1379,6 +1385,31 @@ inline void subplot(long nrows, long ncols, long plot_number) Py_DECREF(res); } +void subplot2grid(long nrows, long ncols, long rowid=0, long colid=0, long rowspan=1, long colspan=1) +{ + PyObject* shape = PyTuple_New(2); + PyTuple_SetItem(shape, 0, PyLong_FromLong(nrows)); + PyTuple_SetItem(shape, 1, PyLong_FromLong(ncols)); + + PyObject* loc = PyTuple_New(2); + PyTuple_SetItem(loc, 0, PyLong_FromLong(rowid)); + PyTuple_SetItem(loc, 1, PyLong_FromLong(colid)); + + PyObject* args = PyTuple_New(4); + PyTuple_SetItem(args, 0, shape); + PyTuple_SetItem(args, 1, loc); + PyTuple_SetItem(args, 2, PyLong_FromLong(rowspan)); + PyTuple_SetItem(args, 3, PyLong_FromLong(colspan)); + + PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_subplot2grid, args); + if(!res) throw std::runtime_error("Call to subplot2grid() failed."); + + Py_DECREF(shape); + Py_DECREF(loc); + Py_DECREF(args); + Py_DECREF(res); +} + inline void title(const std::string &titlestr, const std::map &keywords = {}) { PyObject* pytitlestr = PyString_FromString(titlestr.c_str()); From 5adfbe031e9a9a50b9f4f054aceba4cfd805fa52 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 25 Oct 2019 03:25:48 +0200 Subject: [PATCH 23/86] Rearrange Makefile. --- Makefile | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 15c9f69..4faeb0e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ - # Use C++11 CXXFLAGS += -std=c++11 @@ -10,19 +9,25 @@ CXXFLAGS += $(PYTHON_INCLUDE) LDFLAGS += $(shell $(PYTHON_CONFIG) --libs) # Either finds numpy or set -DWITHOUT_NUMPY -CURRENT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -CXXFLAGS += $(shell $(PYTHON_BIN) $(CURRENT_DIR)/numpy_flags.py) +CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) +WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) -# Assume every *.cpp file is a separate example -SOURCES ?= $(wildcard examples/*.cpp) -EXECUTABLES := $(foreach exec,$(basename $(SOURCES)),$(exec)) +# Examples requiring numpy support to compile +EXAMPLES_NUMPY := surface +EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar fill_inbetween fill update subplot2grid \ + $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY)) + +# Prefix every example with 'examples/build/' +EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES)) .PHONY: examples -examples: $(EXECUTABLES) +examples: $(EXAMPLE_TARGETS) -$(EXECUTABLES): %: %.cpp +# Assume every *.cpp file is a separate example +$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp + mkdir -p examples/build $(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS) clean: - rm -f ${EXECUTABLES} + rm -f ${EXAMPLE_TARGETS} From 97729fd2ccf71873479a32e6577e0e58554e00dd Mon Sep 17 00:00:00 2001 From: Matthieu Zins Date: Sun, 24 Nov 2019 22:06:49 +0100 Subject: [PATCH 24/86] Add possibility to pass additional parameters to scatter (like color or label) --- matplotlibcpp.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 82dbc6b..ac28937 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -659,7 +659,8 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", template bool scatter(const std::vector& x, const std::vector& y, - const double s=1.0) // The marker size in points**2 + const double s=1.0, // The marker size in points**2 + const std::unordered_map & keywords = {}) { assert(x.size() == y.size()); @@ -668,6 +669,10 @@ bool scatter(const std::vector& x, PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "s", PyLong_FromLong(s)); + for (const auto& it : keywords) + { + PyDict_SetItemString(kwargs, it.first.c_str(), PyString_FromString(it.second.c_str())); + } PyObject* plot_args = PyTuple_New(2); PyTuple_SetItem(plot_args, 0, xarray); From 6fb6a91568380614b7576587a4e19680b08e3fa2 Mon Sep 17 00:00:00 2001 From: Matthieu Zins Date: Wed, 27 Nov 2019 07:09:27 +0100 Subject: [PATCH 25/86] Fix multiple definition of subplot2grid --- matplotlibcpp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index ac28937..8ae5b84 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1390,7 +1390,7 @@ inline void subplot(long nrows, long ncols, long plot_number) Py_DECREF(res); } -void subplot2grid(long nrows, long ncols, long rowid=0, long colid=0, long rowspan=1, long colspan=1) +inline void subplot2grid(long nrows, long ncols, long rowid=0, long colid=0, long rowspan=1, long colspan=1) { PyObject* shape = PyTuple_New(2); PyTuple_SetItem(shape, 0, PyLong_FromLong(nrows)); From 8297ae81a09cd48c02bf7615596663db7a3345dc Mon Sep 17 00:00:00 2001 From: belre9 Date: Mon, 18 Nov 2019 18:43:13 +0900 Subject: [PATCH 26/86] Implemented wrapper corresponding to tick_params in matplotlib --- matplotlibcpp.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 8ae5b84..c4d5d14 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -73,6 +73,7 @@ struct _interpreter { PyObject *s_python_function_ylabel; PyObject *s_python_function_xticks; PyObject *s_python_function_yticks; + PyObject *s_python_function_tick_params; PyObject *s_python_function_grid; PyObject *s_python_function_clf; PyObject *s_python_function_errorbar; @@ -203,6 +204,7 @@ struct _interpreter { s_python_function_ylabel = safe_import(pymod, "ylabel"); s_python_function_xticks = safe_import(pymod, "xticks"); s_python_function_yticks = safe_import(pymod, "yticks"); + s_python_function_tick_params = safe_import(pymod, "tick_params"); s_python_function_grid = safe_import(pymod, "grid"); s_python_function_xlim = safe_import(pymod, "xlim"); s_python_function_ion = safe_import(pymod, "ion"); @@ -1375,6 +1377,30 @@ inline void yticks(const std::vector &ticks, const std::map& keywords, const std::string axis = "both") +{ + // construct positional args + PyObject* args; + args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyString_FromString(axis.c_str())); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for (std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_tick_params, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + if (!res) throw std::runtime_error("Call to tick_params() failed"); + + Py_DECREF(res); +} + inline void subplot(long nrows, long ncols, long plot_number) { // construct positional args From d68740570c7c04bbdbdf9960aa5fb36a76ef0c94 Mon Sep 17 00:00:00 2001 From: Marcus Davi <37623906+Marcus-Davi@users.noreply.github.com> Date: Wed, 4 Dec 2019 00:37:19 -0300 Subject: [PATCH 27/86] Added #include "unordered_map" to main header Simply following README.md steps produced an error where "unordered_map" types were not found; Fixed by simply including it on the main header file. --- matplotlibcpp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index c4d5d14..477bf75 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -9,6 +9,7 @@ #include #include // requires c++11 support #include +#include #include From 61da78fbbe4644a8a50fdbfe31a578b2a116ff3e Mon Sep 17 00:00:00 2001 From: Ilya Makarov Date: Fri, 13 Dec 2019 02:28:20 +0700 Subject: [PATCH 28/86] Updated cmake readme section. --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 338bea7..3839169 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,21 @@ matplotlib-cpp. If you prefer to use CMake as build system, you will want to add something like this to your CMakeLists.txt: + +**Recommended way(since CMake 3.12):** + +It's easy to use cmake official [docs](https://cmake.org/cmake/help/git-stage/module/FindPython2.html#module:FindPython2) to find Python 2(or 3) interpreter, compiler and development environment (include directories and libraries). + +NumPy is optional here, delete it from cmake script, if you don't need it. + +```cmake +find_package(Python2 COMPONENTS Development NumPy) +target_include_directories(myproject PRIVATE ${Python2_INCLUDE_DIRS} ${Python2_NumPy_INCLUDE_DIRS}) +target_link_libraries(myproject Python2::Python Python2::NumPy) +``` + +**Legacy way(unrecommended):** + ```cmake find_package(PythonLibs 2.7) target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS}) From 7219c6187ffc967219953f04addce34c955649d4 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 20 Dec 2019 14:55:57 +0100 Subject: [PATCH 29/86] Updated wording in README. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3839169..a82b675 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,7 @@ matplotlib-cpp. If you prefer to use CMake as build system, you will want to add something like this to your CMakeLists.txt: -**Recommended way(since CMake 3.12):** +**Recommended way (since CMake 3.12):** It's easy to use cmake official [docs](https://cmake.org/cmake/help/git-stage/module/FindPython2.html#module:FindPython2) to find Python 2(or 3) interpreter, compiler and development environment (include directories and libraries). @@ -224,7 +224,7 @@ target_include_directories(myproject PRIVATE ${Python2_INCLUDE_DIRS} ${Python2_N target_link_libraries(myproject Python2::Python Python2::NumPy) ``` -**Legacy way(unrecommended):** +**Alternative way (for CMake <= 3.11):** ```cmake find_package(PythonLibs 2.7) From f23347fca25219d1c42cbb91608b5556814bf572 Mon Sep 17 00:00:00 2001 From: Ilya Makarov Date: Wed, 18 Dec 2019 00:46:56 +0700 Subject: [PATCH 30/86] Added information about backend renderer issue on MacOS --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a82b675..72bab39 100644 --- a/README.md +++ b/README.md @@ -288,3 +288,6 @@ Todo/Issues/Wishlist * If you use Anaconda on Windows, you might need to set PYTHONHOME to Anaconda home directory and QT_QPA_PLATFORM_PLUGIN_PATH to %PYTHONHOME%Library/plugins/platforms. The latter is for especially when you get the error which says 'This application failed to start because it could not find or load the Qt platform plugin "windows" in "".' + +* MacOS: `Unable to import matplotlib.pyplot`. Cause: In mac os image rendering back end of matplotlib (what-is-a-backend to render using the API of Cocoa by default). There is Qt4Agg and GTKAgg and as a back-end is not the default. Set the back end of macosx that is differ compare with other windows or linux os. +Solution is discribed [here](https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python?noredirect=1&lq=1), additional information can be found there too(see links in answers). From f1af639c4271616d0ae35ae234f4511577c53f30 Mon Sep 17 00:00:00 2001 From: Trevor Keller Date: Sun, 12 May 2019 02:08:12 -0400 Subject: [PATCH 31/86] implement colorbar; requires returned PyObject of mappable object catch call without mappable object stray { add keywords (shrink is particularly useful) --- Makefile | 3 ++- examples/colorbar.cpp | 32 ++++++++++++++++++++++++++++++++ matplotlibcpp.h | 41 +++++++++++++++++++++++++++++++++-------- 3 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 examples/colorbar.cpp diff --git a/Makefile b/Makefile index 4faeb0e..418554c 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) # Examples requiring numpy support to compile EXAMPLES_NUMPY := surface -EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar fill_inbetween fill update subplot2grid \ +EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \ + fill_inbetween fill update subplot2grid colorbar \ $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY)) # Prefix every example with 'examples/build/' diff --git a/examples/colorbar.cpp b/examples/colorbar.cpp new file mode 100644 index 0000000..f53e01d --- /dev/null +++ b/examples/colorbar.cpp @@ -0,0 +1,32 @@ +#define _USE_MATH_DEFINES +#include +#include +#include "../matplotlibcpp.h" + +using namespace std; +namespace plt = matplotlibcpp; + +int main() +{ + // Prepare data + int ncols = 500, nrows = 300; + std::vector z(ncols * nrows); + for (int j=0; j& y, long bins=10,std::string color="b", #ifndef WITHOUT_NUMPY namespace internal { - inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords) + inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords, PyObject** out) { assert(type == NPY_UINT8 || type == NPY_FLOAT); assert(colors == 1 || colors == 3 || colors == 4); @@ -613,18 +614,21 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", Py_DECREF(kwargs); if (!res) throw std::runtime_error("Call to imshow() failed"); - Py_DECREF(res); + if (out) + *out = res; + else + Py_DECREF(res); } } - inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) { - internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords); + internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords, out); } - inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}) + inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) { - internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords); + internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords, out); } #ifdef WITH_OPENCV @@ -1136,6 +1140,27 @@ void text(Numeric x, Numeric y, const std::string& s = "") Py_DECREF(res); } +void colorbar(PyObject* mappable = NULL, const std::map& keywords = {}) +{ + if (mappable == NULL) + throw std::runtime_error("Must call colorbar with PyObject* returned from an image, contour, surface, etc."); + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, mappable); + + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyFloat_FromDouble(it->second)); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_colorbar, args, kwargs); + if(!res) throw std::runtime_error("Call to colorbar() failed."); + + Py_DECREF(args); + Py_DECREF(kwargs); + Py_DECREF(res); +} + inline long figure(long number = -1) { From de33a574574ac9d630f50f43f3a1bb02e8e14cfe Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 28 Mar 2020 01:07:53 +0100 Subject: [PATCH 32/86] Rename make variable CXXFLAGS -> EXTRA_FLAGS Since CXXFLAGS is supposed to hold user-provided flags, the build should not break when a user manually overrides these. --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 418554c..7b791a5 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ -# Use C++11 -CXXFLAGS += -std=c++11 +# Use C++11, dont warn on long-to-float conversion +CXXFLAGS += -std=c++11 -Wno-conversion # Default to using system's default version of python PYTHON_BIN ?= python PYTHON_CONFIG := $(PYTHON_BIN)-config PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes) -CXXFLAGS += $(PYTHON_INCLUDE) +EXTRA_FLAGS := $(PYTHON_INCLUDE) LDFLAGS += $(shell $(PYTHON_CONFIG) --libs) # Either finds numpy or set -DWITHOUT_NUMPY -CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) +EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) # Examples requiring numpy support to compile @@ -28,7 +28,7 @@ examples: $(EXAMPLE_TARGETS) # Assume every *.cpp file is a separate example $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp mkdir -p examples/build - $(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS) + $(CXX) -o $@ $< $(EXTRA_FLAGS) $(CXXFLAGS) $(LDFLAGS) clean: rm -f ${EXAMPLE_TARGETS} From d283d47d089a74b095dc314275013b17d860fc3d Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 28 Mar 2020 01:10:08 +0100 Subject: [PATCH 33/86] Remove indentation around 'imshow()' functions The code had 1-2 extra levels of indentation. --- matplotlibcpp.h | 128 ++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 595fc89..1c3adc3 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -589,77 +589,79 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", } #ifndef WITHOUT_NUMPY - namespace internal { - inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords, PyObject** out) - { - assert(type == NPY_UINT8 || type == NPY_FLOAT); - assert(colors == 1 || colors == 3 || colors == 4); - - detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work - - // construct args - npy_intp dims[3] = { rows, columns, colors }; - PyObject *args = PyTuple_New(1); - PyTuple_SetItem(args, 0, PyArray_SimpleNewFromData(colors == 1 ? 2 : 3, dims, type, ptr)); - - // construct keyword args - PyObject* kwargs = PyDict_New(); - for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) - { - PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); - } - - PyObject *res = PyObject_Call(detail::_interpreter::get().s_python_function_imshow, args, kwargs); - Py_DECREF(args); - Py_DECREF(kwargs); - if (!res) - throw std::runtime_error("Call to imshow() failed"); - if (out) - *out = res; - else - Py_DECREF(res); - } - } +namespace internal { - inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) - { - internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords, out); - } +inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords, PyObject** out) +{ + assert(type == NPY_UINT8 || type == NPY_FLOAT); + assert(colors == 1 || colors == 3 || colors == 4); + + detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work - inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) + // construct args + npy_intp dims[3] = { rows, columns, colors }; + PyObject *args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyArray_SimpleNewFromData(colors == 1 ? 2 : 3, dims, type, ptr)); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { - internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords, out); + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); } -#ifdef WITH_OPENCV - void imshow(const cv::Mat &image, const std::map &keywords = {}) - { - // Convert underlying type of matrix, if needed - cv::Mat image2; - NPY_TYPES npy_type = NPY_UINT8; - switch (image.type() & CV_MAT_DEPTH_MASK) { - case CV_8U: - image2 = image; - break; - case CV_32F: - image2 = image; - npy_type = NPY_FLOAT; - break; - default: - image.convertTo(image2, CV_MAKETYPE(CV_8U, image.channels())); - } + PyObject *res = PyObject_Call(detail::_interpreter::get().s_python_function_imshow, args, kwargs); + Py_DECREF(args); + Py_DECREF(kwargs); + if (!res) + throw std::runtime_error("Call to imshow() failed"); + if (out) + *out = res; + else + Py_DECREF(res); +} - // If color image, convert from BGR to RGB - switch (image2.channels()) { - case 3: - cv::cvtColor(image2, image2, CV_BGR2RGB); - break; - case 4: - cv::cvtColor(image2, image2, CV_BGRA2RGBA); - } +} // namespace internal + +inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) +{ + internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords, out); +} - internal::imshow(image2.data, npy_type, image2.rows, image2.cols, image2.channels(), keywords); +inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) +{ + internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords, out); +} + +#ifdef WITH_OPENCV +void imshow(const cv::Mat &image, const std::map &keywords = {}) +{ + // Convert underlying type of matrix, if needed + cv::Mat image2; + NPY_TYPES npy_type = NPY_UINT8; + switch (image.type() & CV_MAT_DEPTH_MASK) { + case CV_8U: + image2 = image; + break; + case CV_32F: + image2 = image; + npy_type = NPY_FLOAT; + break; + default: + image.convertTo(image2, CV_MAKETYPE(CV_8U, image.channels())); } + + // If color image, convert from BGR to RGB + switch (image2.channels()) { + case 3: + cv::cvtColor(image2, image2, CV_BGR2RGB); + break; + case 4: + cv::cvtColor(image2, image2, CV_BGRA2RGBA); + } + + internal::imshow(image2.data, npy_type, image2.rows, image2.cols, image2.channels(), keywords); +} #endif // WITH_OPENCV #endif // WITHOUT_NUMPY From 1809d7a261d086cc7ab52383f772fe04c437d1b0 Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Sun, 5 Jan 2020 19:14:16 +0100 Subject: [PATCH 34/86] Adds axvline to function scope --- matplotlibcpp.h | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 1c3adc3..fa9e58a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -70,6 +70,7 @@ struct _interpreter { PyObject *s_python_function_ylim; PyObject *s_python_function_title; PyObject *s_python_function_axis; + PyObject *s_python_function_axvline; PyObject *s_python_function_xlabel; PyObject *s_python_function_ylabel; PyObject *s_python_function_xticks; @@ -202,6 +203,7 @@ struct _interpreter { s_python_function_ylim = safe_import(pymod, "ylim"); s_python_function_title = safe_import(pymod, "title"); s_python_function_axis = safe_import(pymod, "axis"); + s_python_function_axvline = safe_import(pymod, "axvline"); s_python_function_xlabel = safe_import(pymod, "xlabel"); s_python_function_ylabel = safe_import(pymod, "ylabel"); s_python_function_xticks = safe_import(pymod, "xticks"); @@ -1411,21 +1413,21 @@ inline void tick_params(const std::map& keywords, cons PyObject* args; args = PyTuple_New(1); PyTuple_SetItem(args, 0, PyString_FromString(axis.c_str())); - + // construct keyword args PyObject* kwargs = PyDict_New(); for (std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); } - - + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_tick_params, args, kwargs); - + Py_DECREF(args); Py_DECREF(kwargs); if (!res) throw std::runtime_error("Call to tick_params() failed"); - + Py_DECREF(res); } @@ -1520,6 +1522,29 @@ inline void axis(const std::string &axisstr) Py_DECREF(res); } +void axvline(double x, double ymin = 0., double ymax = 1., const std::map& keywords = std::map()) +{ + // construct positional args + PyObject* args = PyTuple_New(3); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(x)); + PyTuple_SetItem(args, 1, PyFloat_FromDouble(ymin)); + PyTuple_SetItem(args, 2, PyFloat_FromDouble(ymax)); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axvline, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + + if(res) Py_DECREF(res); +} + inline void xlabel(const std::string &str, const std::map &keywords = {}) { PyObject* pystr = PyString_FromString(str.c_str()); From 52816e2f8b7cf237ecf88d22d26b16f223e74318 Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Mon, 6 Jan 2020 23:40:56 +0100 Subject: [PATCH 35/86] Adds boxplot, get_strarray and get_listlist --- matplotlibcpp.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index fa9e58a..1836c4b 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -61,6 +61,7 @@ struct _interpreter { PyObject *s_python_function_hist; PyObject *s_python_function_imshow; PyObject *s_python_function_scatter; + PyObject *s_python_function_boxplot; PyObject *s_python_function_subplot; PyObject *s_python_function_subplot2grid; PyObject *s_python_function_legend; @@ -197,6 +198,7 @@ struct _interpreter { s_python_function_fill_between = safe_import(pymod, "fill_between"); s_python_function_hist = safe_import(pymod,"hist"); s_python_function_scatter = safe_import(pymod,"scatter"); + s_python_function_boxplot = safe_import(pymod,"boxplot"); s_python_function_subplot = safe_import(pymod, "subplot"); s_python_function_subplot2grid = safe_import(pymod, "subplot2grid"); s_python_function_legend = safe_import(pymod, "legend"); @@ -326,6 +328,27 @@ PyObject* get_2darray(const std::vector<::std::vector>& v) return reinterpret_cast(varray); } +// sometimes, for labels and such, we need string arrays +PyObject * get_array(const std::vector& strings) +{ + PyObject* list = PyList_New(strings.size()); + for (std::size_t i = 0; i < strings.size(); ++i) { + PyList_SetItem(list, i, PyString_FromString(strings[i].c_str())); + } + return list; +} + +// not all matplotlib need 2d arrays, some prefer lists of lists +template +PyObject* get_listlist(const std::vector>& ll) +{ + PyObject* listlist = PyList_New(ll.size()); + for (std::size_t i = 0; i < ll.size(); ++i) { + PyList_SetItem(listlist, i, get_array(ll[i])); + } + return listlist; +} + #else // fallback if we don't have numpy: copy every element of the given vector template @@ -698,6 +721,62 @@ bool scatter(const std::vector& x, return res; } +template +bool boxplot(const std::vector>& data, + const std::vector& labels = {}, + const std::unordered_map & keywords = {}) +{ + PyObject* listlist = get_listlist(data); + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, listlist); + + PyObject* kwargs = PyDict_New(); + + // kwargs needs the labels, if there are (the correct number of) labels + if (!labels.empty() && labels.size() == data.size()) { + PyDict_SetItemString(kwargs, "labels", get_array(labels)); + } + + // take care of the remaining keywords + for (const auto& it : keywords) + { + PyDict_SetItemString(kwargs, it.first.c_str(), PyString_FromString(it.second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_boxplot, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + + if(res) Py_DECREF(res); + + return res; +} + +template +bool boxplot(const std::vector& data, + const std::unordered_map & keywords = {}) +{ + PyObject* vector = get_array(data); + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, vector); + + PyObject* kwargs = PyDict_New(); + for (const auto& it : keywords) + { + PyDict_SetItemString(kwargs, it.first.c_str(), PyString_FromString(it.second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_boxplot, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + + if(res) Py_DECREF(res); + + return res; +} + template bool bar(const std::vector & x, const std::vector & y, From 9b23ca06b463a0d5b8c4dfdd3afd94cae5e8a4f3 Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Mon, 6 Jan 2020 23:45:40 +0100 Subject: [PATCH 36/86] Adds vim tempfiles to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 7622be7..1c4a1b0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ # Build /examples/build/* + +# vim temp files +*.sw* From 811ebfb2c9d96536480b38392e215ba4506c2f95 Mon Sep 17 00:00:00 2001 From: Brian Phung Date: Wed, 1 Jan 2020 12:12:21 -0700 Subject: [PATCH 37/86] Add 3D line plot and zlabel function. --- Makefile | 2 +- examples/lines3d.cpp | 30 ++++++++++ examples/lines3d.png | Bin 0 -> 76500 bytes matplotlibcpp.h | 135 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 examples/lines3d.cpp create mode 100644 examples/lines3d.png diff --git a/Makefile b/Makefile index 7b791a5..a4a8a28 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) # Examples requiring numpy support to compile EXAMPLES_NUMPY := surface EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \ - fill_inbetween fill update subplot2grid colorbar \ + fill_inbetween fill update subplot2grid colorbar lines3d \ $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY)) # Prefix every example with 'examples/build/' diff --git a/examples/lines3d.cpp b/examples/lines3d.cpp new file mode 100644 index 0000000..f3c201c --- /dev/null +++ b/examples/lines3d.cpp @@ -0,0 +1,30 @@ +#include "../matplotlibcpp.h" + +#include + +namespace plt = matplotlibcpp; + +int main() +{ + std::vector x, y, z; + double theta, r; + double z_inc = 4.0/99.0; double theta_inc = (8.0 * M_PI)/99.0; + + for (double i = 0; i < 100; i += 1) { + theta = -4.0 * M_PI + theta_inc*i; + z.push_back(-2.0 + z_inc*i); + r = z[i]*z[i] + 1; + x.push_back(r * sin(theta)); + y.push_back(r * cos(theta)); + } + + std::map keywords; + keywords.insert(std::pair("label", "parametric curve") ); + + plt::plot3(x, y, z, keywords); + plt::xlabel("x label"); + plt::ylabel("y label"); + plt::set_zlabel("z label"); // set_zlabel rather than just zlabel, in accordance with the Axes3D method + plt::legend(); + plt::show(); +} diff --git a/examples/lines3d.png b/examples/lines3d.png new file mode 100644 index 0000000000000000000000000000000000000000..7a0c478a0a598d36abb24b2f1d458d65316a60e6 GIT binary patch literal 76500 zcmeFZ1zVME*EPC8Bn6R{?vQSzK}u4(J4K|+0wkoQ1f`LXk_JIix}>DLm5`Pe!9AD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l%BN`1YIN$T0g+XT!ZEE#nT@jVdf$6w+EwWn$q7R37ArSl~pHlu z{TPq|D52|ZF3m*qXy2(*{|H?e;1p2ydB0_y@yU~ypl2oR5&Oj_=MEx_!Us~ux^flD zB#$6iXgPkUyMUTw@{L%G2(l4aRv#Ev_YDku+V)(RQFM0gmsJ{!G2I{+sjpw8rL98w zMOqud2@2lOPmrqe-aTPTFYK#`!L`h}p(7M^2%CUX3O_@h1`Vy|7Ot-!9_mqo5f=I} zY!wj`!%p%gA{LpxgdvR2&-%?p3rC-S22(FbUFbgPe{~M?W~4+z>z}Z+OH)ju)h7_F z53mnnS{L6<7!iyTT(&qUg*Ij_4q!AhG>M1B`u$Cm_tD!UlSOA&*cloB@~_Zl{B^m4Oo$8?_w~^j8XAH}MG=nOfNbCe zC?>kikTbq%YN`PR{3hKFV@?0i3j$Ihz{J{|Gby6NE-_CK4e$3+&YBGEU>rWyR5!7-XhdCX(^LP zf|j3#udgBqN+`WADS#_H7bx$S79r%z2rSW_?~>FZ zL=d!5-kJ5t6yX>iN*crAE?o!AP^699)CW?wZ&?bmfC>g-tX}aBw zSv$aA*~+pK(LVqiHzq4_tLybgK<*79Bjxj%;j2_ZK!SK(yZnW+bHi&1>e;t%U*eby zz7gTiIyWOeU{>P zaeP?+X%$kmE@*iSOM+pfqhO@~SOY6e4FesQV|Gj$?GlpBNRtb5wNSKNyM0^t`w9!J zhDe(O0Fk^=(hr1X)(7XoDRI4o-WF})8clYUQy`hcID&Tuhy7MWdydc|2u_ovFOiZ$ zVOO4{l$4ep1&YpfXtn_qrMw@>4WeX$m2mZYK_(f|w&~ZJ;n0XIA`FkzZYUL$u@6G4 zKtV}~09hhBIBfXYFCGLKcuAtG!zrJ8Er5>|jq+VIjbV@H0Hb|lqV>y!!rv?MkG>;aC}k@{IZk^L;Er`tS> &x, } #endif // WITHOUT_NUMPY +template +void plot3(const std::vector &x, + const std::vector &y, + const std::vector &z, + const std::map &keywords = + std::map()) +{ + // Same as with plot_surface: We lazily load the modules here the first time + // this function is called because I'm not sure that we can assume "matplotlib + // installed" implies "mpl_toolkits installed" on all platforms, and we don't + // want to require it for people who don't need 3d plots. + static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; + if (!mpl_toolkitsmod) { + detail::_interpreter::get(); + + PyObject* mpl_toolkits = PyString_FromString("mpl_toolkits"); + PyObject* axis3d = PyString_FromString("mpl_toolkits.mplot3d"); + if (!mpl_toolkits || !axis3d) { throw std::runtime_error("couldnt create string"); } + + mpl_toolkitsmod = PyImport_Import(mpl_toolkits); + Py_DECREF(mpl_toolkits); + if (!mpl_toolkitsmod) { throw std::runtime_error("Error loading module mpl_toolkits!"); } + + axis3dmod = PyImport_Import(axis3d); + Py_DECREF(axis3d); + if (!axis3dmod) { throw std::runtime_error("Error loading module mpl_toolkits.mplot3d!"); } + } + + assert(x.size() == y.size()); + assert(y.size() == z.size()); + + PyObject *xarray = get_array(x); + PyObject *yarray = get_array(y); + PyObject *zarray = get_array(z); + + // construct positional args + PyObject *args = PyTuple_New(3); + PyTuple_SetItem(args, 0, xarray); + PyTuple_SetItem(args, 1, yarray); + PyTuple_SetItem(args, 2, zarray); + + // Build up the kw args. + PyObject *kwargs = PyDict_New(); + + for (std::map::const_iterator it = keywords.begin(); + it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } + + PyObject *fig = + PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + detail::_interpreter::get().s_python_empty_tuple); + if (!fig) throw std::runtime_error("Call to figure() failed."); + + PyObject *gca_kwargs = PyDict_New(); + PyDict_SetItemString(gca_kwargs, "projection", PyString_FromString("3d")); + + PyObject *gca = PyObject_GetAttrString(fig, "gca"); + if (!gca) throw std::runtime_error("No gca"); + Py_INCREF(gca); + PyObject *axis = PyObject_Call( + gca, detail::_interpreter::get().s_python_empty_tuple, gca_kwargs); + + if (!axis) throw std::runtime_error("No axis"); + Py_INCREF(axis); + + Py_DECREF(gca); + Py_DECREF(gca_kwargs); + + PyObject *plot3 = PyObject_GetAttrString(axis, "plot"); + if (!plot3) throw std::runtime_error("No 3D line plot"); + Py_INCREF(plot3); + PyObject *res = PyObject_Call(plot3, args, kwargs); + if (!res) throw std::runtime_error("Failed 3D line plot"); + Py_DECREF(plot3); + + Py_DECREF(axis); + Py_DECREF(args); + Py_DECREF(kwargs); + if (res) Py_DECREF(res); +} template bool stem(const std::vector &x, const std::vector &y, const std::map& keywords) @@ -1662,6 +1746,57 @@ inline void ylabel(const std::string &str, const std::map& keywords = {}) { + // Same as with plot_surface: We lazily load the modules here the first time + // this function is called because I'm not sure that we can assume "matplotlib + // installed" implies "mpl_toolkits installed" on all platforms, and we don't + // want to require it for people who don't need 3d plots. + static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; + if (!mpl_toolkitsmod) { + detail::_interpreter::get(); + + PyObject* mpl_toolkits = PyString_FromString("mpl_toolkits"); + PyObject* axis3d = PyString_FromString("mpl_toolkits.mplot3d"); + if (!mpl_toolkits || !axis3d) { throw std::runtime_error("couldnt create string"); } + + mpl_toolkitsmod = PyImport_Import(mpl_toolkits); + Py_DECREF(mpl_toolkits); + if (!mpl_toolkitsmod) { throw std::runtime_error("Error loading module mpl_toolkits!"); } + + axis3dmod = PyImport_Import(axis3d); + Py_DECREF(axis3d); + if (!axis3dmod) { throw std::runtime_error("Error loading module mpl_toolkits.mplot3d!"); } + } + + PyObject* pystr = PyString_FromString(str.c_str()); + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, pystr); + + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject *ax = + PyObject_CallObject(detail::_interpreter::get().s_python_function_gca, + detail::_interpreter::get().s_python_empty_tuple); + if (!ax) throw std::runtime_error("Call to gca() failed."); + Py_INCREF(ax); + + PyObject *zlabel = PyObject_GetAttrString(ax, "set_zlabel"); + if (!zlabel) throw std::runtime_error("Attribute set_zlabel not found."); + Py_INCREF(zlabel); + + PyObject *res = PyObject_Call(zlabel, args, kwargs); + if (!res) throw std::runtime_error("Call to set_zlabel() failed."); + Py_DECREF(zlabel); + + Py_DECREF(ax); + Py_DECREF(args); + Py_DECREF(kwargs); + if (res) Py_DECREF(res); +} + inline void grid(bool flag) { PyObject* pyflag = flag ? Py_True : Py_False; From 41477fcdb6fc3ba2c4967dfada01609bfd620a1d Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sun, 29 Mar 2020 20:46:52 +0200 Subject: [PATCH 38/86] Add experimental documentation target Add experimental `docs` target to create automated API documentation. Also moved all internal things into one unified namespace `detail`. --- Makefile | 6 +- matplotlibcpp.h | 142 ++++++++++++++++++++++++++---------------------- 2 files changed, 83 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index a4a8a28..8df417f 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,12 @@ EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES)) examples: $(EXAMPLE_TARGETS) +docs: + doxygen + moxygen doc/xml --noindex -o doc/api.md + # Assume every *.cpp file is a separate example -$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp +$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp matplotlibcpp.h mkdir -p examples/build $(CXX) -o $@ $< $(EXTRA_FLAGS) $(CXXFLAGS) $(LDFLAGS) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index da86704..ed4e347 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -242,7 +242,15 @@ struct _interpreter { } // end namespace detail -// must be called before the first regular call to matplotlib to have any effect +/// Select the backend +/// +/// **NOTE:** This must be called before the first plot command to have +/// any effect. +/// +/// Mainly useful to select the non-interactive 'Agg' backend when running +/// matplotlibcpp in headless mode, for example on a machine with no display. +/// +/// See also: https://matplotlib.org/2.0.2/api/matplotlib_configuration_api.html#matplotlib.use inline void backend(const std::string& name) { detail::s_backend = name; @@ -272,6 +280,8 @@ inline bool annotate(std::string annotation, double x, double y) return res; } +namespace detail { + #ifndef WITHOUT_NUMPY // Type selector for numpy array conversion template struct select_npy_type { const static NPY_TYPES type = NPY_NOTYPE; }; //Default @@ -365,14 +375,19 @@ PyObject* get_array(const std::vector& v) #endif // WITHOUT_NUMPY +} // namespace detail + +/// Plot a line through the given x and y data points.. +/// +/// See: https://matplotlib.org/3.2.1/api/_as_gen/matplotlib.pyplot.plot.html template bool plot(const std::vector &x, const std::vector &y, const std::map& keywords) { assert(x.size() == y.size()); // using numpy arrays - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); // construct positional args PyObject* args = PyTuple_New(2); @@ -396,7 +411,7 @@ bool plot(const std::vector &x, const std::vector &y, const st } // TODO - it should be possible to make this work by implementing -// a non-numpy alternative for `get_2darray()`. +// a non-numpy alternative for `detail::get_2darray()`. #ifndef WITHOUT_NUMPY template void plot_surface(const std::vector<::std::vector> &x, @@ -430,9 +445,9 @@ void plot_surface(const std::vector<::std::vector> &x, assert(y.size() == z.size()); // using numpy arrays - PyObject *xarray = get_2darray(x); - PyObject *yarray = get_2darray(y); - PyObject *zarray = get_2darray(z); + PyObject *xarray = detail::get_2darray(x); + PyObject *yarray = detail::get_2darray(y); + PyObject *zarray = detail::get_2darray(z); // construct positional args PyObject *args = PyTuple_New(3); @@ -522,9 +537,9 @@ void plot3(const std::vector &x, assert(x.size() == y.size()); assert(y.size() == z.size()); - PyObject *xarray = get_array(x); - PyObject *yarray = get_array(y); - PyObject *zarray = get_array(z); + PyObject *xarray = detail::get_array(x); + PyObject *yarray = detail::get_array(y); + PyObject *zarray = detail::get_array(z); // construct positional args PyObject *args = PyTuple_New(3); @@ -580,8 +595,8 @@ bool stem(const std::vector &x, const std::vector &y, const st assert(x.size() == y.size()); // using numpy arrays - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); // construct positional args PyObject* args = PyTuple_New(2); @@ -613,8 +628,8 @@ bool fill(const std::vector& x, const std::vector& y, const st assert(x.size() == y.size()); // using numpy arrays - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); // construct positional args PyObject* args = PyTuple_New(2); @@ -644,9 +659,9 @@ bool fill_between(const std::vector& x, const std::vector& y1, assert(x.size() == y2.size()); // using numpy arrays - PyObject* xarray = get_array(x); - PyObject* y1array = get_array(y1); - PyObject* y2array = get_array(y2); + PyObject* xarray = detail::get_array(x); + PyObject* y1array = detail::get_array(y1); + PyObject* y2array = detail::get_array(y2); // construct positional args PyObject* args = PyTuple_New(3); @@ -674,7 +689,7 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", double alpha=1.0, bool cumulative=false) { - PyObject* yarray = get_array(y); + PyObject* yarray = detail::get_array(y); PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "bins", PyLong_FromLong(bins)); @@ -698,7 +713,7 @@ bool hist(const std::vector& y, long bins=10,std::string color="b", } #ifndef WITHOUT_NUMPY -namespace internal { +namespace detail { inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map &keywords, PyObject** out) { @@ -730,16 +745,16 @@ inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int co Py_DECREF(res); } -} // namespace internal +} // namespace detail inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) { - internal::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords, out); + detail::imshow((void *) ptr, NPY_UINT8, rows, columns, colors, keywords, out); } inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map &keywords = {}, PyObject** out = nullptr) { - internal::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords, out); + detail::imshow((void *) ptr, NPY_FLOAT, rows, columns, colors, keywords, out); } #ifdef WITH_OPENCV @@ -769,7 +784,7 @@ void imshow(const cv::Mat &image, const std::map &keyw cv::cvtColor(image2, image2, CV_BGRA2RGBA); } - internal::imshow(image2.data, npy_type, image2.rows, image2.cols, image2.channels(), keywords); + detail::imshow(image2.data, npy_type, image2.rows, image2.cols, image2.channels(), keywords); } #endif // WITH_OPENCV #endif // WITHOUT_NUMPY @@ -782,8 +797,8 @@ bool scatter(const std::vector& x, { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "s", PyLong_FromLong(s)); @@ -810,7 +825,7 @@ bool boxplot(const std::vector>& data, const std::vector& labels = {}, const std::unordered_map & keywords = {}) { - PyObject* listlist = get_listlist(data); + PyObject* listlist = detail::get_listlist(data); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, listlist); @@ -818,7 +833,7 @@ bool boxplot(const std::vector>& data, // kwargs needs the labels, if there are (the correct number of) labels if (!labels.empty() && labels.size() == data.size()) { - PyDict_SetItemString(kwargs, "labels", get_array(labels)); + PyDict_SetItemString(kwargs, "labels", detail::get_array(labels)); } // take care of the remaining keywords @@ -841,7 +856,7 @@ template bool boxplot(const std::vector& data, const std::unordered_map & keywords = {}) { - PyObject* vector = get_array(data); + PyObject* vector = detail::get_array(data); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, vector); @@ -868,8 +883,8 @@ bool bar(const std::vector & x, std::string ls = "-", double lw = 1.0, const std::map & keywords = {}) { - PyObject * xarray = get_array(x); - PyObject * yarray = get_array(y); + PyObject * xarray = detail::get_array(x); + PyObject * yarray = detail::get_array(y); PyObject * kwargs = PyDict_New(); @@ -938,7 +953,7 @@ inline bool subplots_adjust(const std::map& keywords = {}) template< typename Numeric> bool named_hist(std::string label,const std::vector& y, long bins=10, std::string color="b", double alpha=1.0) { - PyObject* yarray = get_array(y); + PyObject* yarray = detail::get_array(y); PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(label.c_str())); @@ -964,8 +979,8 @@ bool plot(const std::vector& x, const std::vector& y, const { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(s.c_str()); @@ -987,10 +1002,10 @@ bool quiver(const std::vector& x, const std::vector& y, cons { assert(x.size() == y.size() && x.size() == u.size() && u.size() == w.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); - PyObject* uarray = get_array(u); - PyObject* warray = get_array(w); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); + PyObject* uarray = detail::get_array(u); + PyObject* warray = detail::get_array(w); PyObject* plot_args = PyTuple_New(4); PyTuple_SetItem(plot_args, 0, xarray); @@ -1021,8 +1036,8 @@ bool stem(const std::vector& x, const std::vector& y, const { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(s.c_str()); @@ -1046,8 +1061,8 @@ bool semilogx(const std::vector& x, const std::vector& y, co { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(s.c_str()); @@ -1069,8 +1084,8 @@ bool semilogy(const std::vector& x, const std::vector& y, co { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(s.c_str()); @@ -1092,8 +1107,8 @@ bool loglog(const std::vector& x, const std::vector& y, cons { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(s.c_str()); @@ -1115,9 +1130,9 @@ bool errorbar(const std::vector &x, const std::vector &y, co { assert(x.size() == y.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); - PyObject* yerrarray = get_array(yerr); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); + PyObject* yerrarray = detail::get_array(yerr); // construct keyword args PyObject* kwargs = PyDict_New(); @@ -1151,7 +1166,7 @@ bool named_plot(const std::string& name, const std::vector& y, const st PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* yarray = get_array(y); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -1175,8 +1190,8 @@ bool named_plot(const std::string& name, const std::vector& x, const st PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -1200,8 +1215,8 @@ bool named_semilogx(const std::string& name, const std::vector& x, cons PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -1225,8 +1240,8 @@ bool named_semilogy(const std::string& name, const std::vector& x, cons PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -1250,8 +1265,8 @@ bool named_loglog(const std::string& name, const std::vector& x, const PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -1482,7 +1497,7 @@ inline void xticks(const std::vector &ticks, const std::vector &ticks, const std::vector& x, const std::vector& y, con /* * This class allows dynamic plots, ie changing the plotted data without clearing and re-plotting */ - class Plot { public: @@ -2110,8 +2124,8 @@ class Plot if(name != "") PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* pystring = PyString_FromString(format.c_str()); @@ -2147,8 +2161,8 @@ class Plot assert(x.size() == y.size()); if(set_data_fct) { - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); PyObject* plot_args = PyTuple_New(2); PyTuple_SetItem(plot_args, 0, xarray); From 7f7b8528b4f0d4d6cbebc00cf7b39001cbb1a801 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Tue, 31 Mar 2020 14:56:15 +0200 Subject: [PATCH 39/86] Fix numpy detection and provide some functions even when numpy is not available --- Makefile | 8 ++++---- matplotlibcpp.h | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 8df417f..60e5f65 100644 --- a/Makefile +++ b/Makefile @@ -10,13 +10,13 @@ LDFLAGS += $(shell $(PYTHON_CONFIG) --libs) # Either finds numpy or set -DWITHOUT_NUMPY EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) -WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) +WITHOUT_NUMPY := $(findstring $(EXTRA_FLAGS), WITHOUT_NUMPY) # Examples requiring numpy support to compile -EXAMPLES_NUMPY := surface +EXAMPLES_NUMPY := surface colorbar EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \ - fill_inbetween fill update subplot2grid colorbar lines3d \ - $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY)) + fill_inbetween fill update subplot2grid lines3d \ + $(if $(WITHOUT_NUMPY),,$(EXAMPLES_NUMPY)) # Prefix every example with 'examples/build/' EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES)) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index ed4e347..55597a7 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -340,6 +340,20 @@ PyObject* get_2darray(const std::vector<::std::vector>& v) return reinterpret_cast(varray); } +#else // fallback if we don't have numpy: copy every element of the given vector + +template +PyObject* get_array(const std::vector& v) +{ + PyObject* list = PyList_New(v.size()); + for(size_t i = 0; i < v.size(); ++i) { + PyList_SetItem(list, i, PyFloat_FromDouble(v.at(i))); + } + return list; +} + +#endif // WITHOUT_NUMPY + // sometimes, for labels and such, we need string arrays PyObject * get_array(const std::vector& strings) { @@ -361,20 +375,6 @@ PyObject* get_listlist(const std::vector>& ll) return listlist; } -#else // fallback if we don't have numpy: copy every element of the given vector - -template -PyObject* get_array(const std::vector& v) -{ - PyObject* list = PyList_New(v.size()); - for(size_t i = 0; i < v.size(); ++i) { - PyList_SetItem(list, i, PyFloat_FromDouble(v.at(i))); - } - return list; -} - -#endif // WITHOUT_NUMPY - } // namespace detail /// Plot a line through the given x and y data points.. From ea527fdcefbc8137921ba1aaacf2ee7fbe5da109 Mon Sep 17 00:00:00 2001 From: tomotakaeru <38675462+tomotakaeru@users.noreply.github.com> Date: Sun, 5 Apr 2020 22:51:41 +0900 Subject: [PATCH 40/86] add "inline" to get_array, color_bar, axvline --- matplotlibcpp.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 55597a7..31838a5 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -298,7 +298,7 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; template -PyObject* get_array(const std::vector& v) +inline PyObject* get_array(const std::vector& v) { detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work NPY_TYPES type = select_npy_type::type; @@ -343,7 +343,7 @@ PyObject* get_2darray(const std::vector<::std::vector>& v) #else // fallback if we don't have numpy: copy every element of the given vector template -PyObject* get_array(const std::vector& v) +inline PyObject* get_array(const std::vector& v) { PyObject* list = PyList_New(v.size()); for(size_t i = 0; i < v.size(); ++i) { @@ -355,7 +355,7 @@ PyObject* get_array(const std::vector& v) #endif // WITHOUT_NUMPY // sometimes, for labels and such, we need string arrays -PyObject * get_array(const std::vector& strings) +inline PyObject * get_array(const std::vector& strings) { PyObject* list = PyList_New(strings.size()); for (std::size_t i = 0; i < strings.size(); ++i) { @@ -1322,7 +1322,7 @@ void text(Numeric x, Numeric y, const std::string& s = "") Py_DECREF(res); } -void colorbar(PyObject* mappable = NULL, const std::map& keywords = {}) +inline void colorbar(PyObject* mappable = NULL, const std::map& keywords = {}) { if (mappable == NULL) throw std::runtime_error("Must call colorbar with PyObject* returned from an image, contour, surface, etc."); @@ -1700,7 +1700,7 @@ inline void axis(const std::string &axisstr) Py_DECREF(res); } -void axvline(double x, double ymin = 0., double ymax = 1., const std::map& keywords = std::map()) +inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map& keywords = std::map()) { // construct positional args PyObject* args = PyTuple_New(3); From 2843ebbe68f7f1d9718bc6a48bb2f6e16af95349 Mon Sep 17 00:00:00 2001 From: tomotakaeru <38675462+tomotakaeru@users.noreply.github.com> Date: Mon, 6 Apr 2020 09:26:36 +0900 Subject: [PATCH 41/86] delete unnecessary "inline" on get_array(vector) --- matplotlibcpp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 31838a5..0112344 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -298,7 +298,7 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; template -inline PyObject* get_array(const std::vector& v) +PyObject* get_array(const std::vector& v) { detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work NPY_TYPES type = select_npy_type::type; @@ -343,7 +343,7 @@ PyObject* get_2darray(const std::vector<::std::vector>& v) #else // fallback if we don't have numpy: copy every element of the given vector template -inline PyObject* get_array(const std::vector& v) +PyObject* get_array(const std::vector& v) { PyObject* list = PyList_New(v.size()); for(size_t i = 0; i < v.size(); ++i) { From e5ffc6ce8309dca4e15f14698a1bdb8a25836241 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Sat, 11 Apr 2020 20:10:29 -0400 Subject: [PATCH 42/86] ensure interpreter is initialized for suptitle & subplot --- matplotlibcpp.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 0112344..9649010 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1611,6 +1611,9 @@ inline void tick_params(const std::map& keywords, cons inline void subplot(long nrows, long ncols, long plot_number) { + // Make sure interpreter is initialized + detail::_interpreter::get(); + // construct positional args PyObject* args = PyTuple_New(3); PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows)); @@ -1670,6 +1673,9 @@ inline void title(const std::string &titlestr, const std::map &keywords = {}) { + // Make sure interpreter is initialized + detail::_interpreter::get(); + PyObject* pysuptitlestr = PyString_FromString(suptitlestr.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pysuptitlestr); From d7839cc47547f70dba104848e3318aa64025f837 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:34:46 +0100 Subject: [PATCH 43/86] :sparkle: Added a first version of Dockerfile --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..850466f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM debian:10 AS builder +RUN apt-get update \ + && apt-get install --yes --no-install-recommends \ + g++ \ + libpython3-dev \ + make \ + python3 \ + python3-dev \ + python3-numpy + +ADD Makefile matplotlibcpp.h numpy_flags.py /opt/ +ADD examples/*.cpp /opt/examples/ +RUN cd /opt \ + && make PYTHON_BIN=python3 \ + && ls examples/build + +FROM debian:10 +RUN apt-get update \ + && apt-get install --yes --no-install-recommends \ + libpython3-dev \ + python3-matplotlib \ + python3-numpy + +COPY --from=builder /opt/examples/build /opt/ +RUN cd /opt \ + && ls \ + && ./basic From 7ef2559239fbc1dc47f9092d650616979a85484e Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:35:12 +0100 Subject: [PATCH 44/86] :sparkle: Added a target to build docker image --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 60e5f65..a1e63bf 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,6 @@ $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp matplotlibcpp.h clean: rm -f ${EXAMPLE_TARGETS} + +docker_build: + docker build . -t matplotlibcpp From fa673c670602e3f6ccb34d9bc3f5b10897cef8f8 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:36:08 +0100 Subject: [PATCH 45/86] :sparkle: Added a first CI file --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bacca68 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: minimal +dist: trusty +services: + - docker +script: + - make docker_build From a7c38ad725c745fd8089fd96c2d17f5410ff74ed Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 23:15:27 +0100 Subject: [PATCH 46/86] :pencil: Typo update in Readme.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 72bab39..a1ad7bd 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ A more comprehensive example: namespace plt = matplotlibcpp; -int main() +int main() { // Prepare data. int n = 5000; @@ -73,26 +73,26 @@ Alternatively, matplotlib-cpp also supports some C++11-powered syntactic sugar: using namespace std; namespace plt = matplotlibcpp; -int main() -{ +int main() +{ // Prepare data. int n = 5000; // number of data points - vector x(n),y(n); + vector x(n),y(n); for(int i=0; i Date: Sat, 28 Mar 2020 09:15:28 +0100 Subject: [PATCH 47/86] :wrench: Moved all elements related to docker build in contrib As requested by maintainer --- .travis.yml | 2 +- Makefile | 3 --- Dockerfile => contrib/Dockerfile | 0 contrib/Makefile | 6 ++++++ 4 files changed, 7 insertions(+), 4 deletions(-) rename Dockerfile => contrib/Dockerfile (100%) create mode 100644 contrib/Makefile diff --git a/.travis.yml b/.travis.yml index bacca68..d6175a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ dist: trusty services: - docker script: - - make docker_build + - make -C contrib docker_build diff --git a/Makefile b/Makefile index a1e63bf..60e5f65 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,3 @@ $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp matplotlibcpp.h clean: rm -f ${EXAMPLE_TARGETS} - -docker_build: - docker build . -t matplotlibcpp diff --git a/Dockerfile b/contrib/Dockerfile similarity index 100% rename from Dockerfile rename to contrib/Dockerfile diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 0000000..f659cd9 --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,6 @@ +all: docker_build + +docker_build: + cd .. && \ + docker build . -f contrib/Dockerfile -t matplotlibcpp && \ + cd contrib From 9595628a80f972c7f3ee5166fe8d91ad50e667b0 Mon Sep 17 00:00:00 2001 From: Mateo Gianolio Date: Fri, 3 Apr 2020 10:33:24 +0200 Subject: [PATCH 48/86] Replace occurrences of std::unordered_map<> with std::map<> --- matplotlibcpp.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 9649010..55a04b1 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -9,7 +9,6 @@ #include #include // requires c++11 support #include -#include #include @@ -793,7 +792,7 @@ template bool scatter(const std::vector& x, const std::vector& y, const double s=1.0, // The marker size in points**2 - const std::unordered_map & keywords = {}) + const std::map & keywords = {}) { assert(x.size() == y.size()); @@ -823,7 +822,7 @@ bool scatter(const std::vector& x, template bool boxplot(const std::vector>& data, const std::vector& labels = {}, - const std::unordered_map & keywords = {}) + const std::map & keywords = {}) { PyObject* listlist = detail::get_listlist(data); PyObject* args = PyTuple_New(1); @@ -854,7 +853,7 @@ bool boxplot(const std::vector>& data, template bool boxplot(const std::vector& data, - const std::unordered_map & keywords = {}) + const std::map & keywords = {}) { PyObject* vector = detail::get_array(data); PyObject* args = PyTuple_New(1); From 1243814dabc8a34fa0b6b9ffc86af5b42e85feed Mon Sep 17 00:00:00 2001 From: NancyLi1013 Date: Wed, 26 Feb 2020 05:29:35 -0800 Subject: [PATCH 49/86] Add vcpkg installation instructions --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index a1ad7bd..ce6480b 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,17 @@ anywhere. Since a python interpreter is opened internally, it is necessary to link against `libpython2.7` in order to use matplotlib-cpp. +You can download and install matplotlib-cpp using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + vcpkg install matplotlib-cpp + +The matplotlib-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + + # CMake If you prefer to use CMake as build system, you will want to add something like this to your From edb40746123e2fdd194083f4e4a75cd985e5c593 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 18 Apr 2020 12:19:26 +0200 Subject: [PATCH 50/86] Reword libpython dependency; move vcpkg section --- README.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ce6480b..61ffef4 100644 --- a/README.md +++ b/README.md @@ -199,23 +199,15 @@ On Ubuntu: sudo apt-get install python-matplotlib python-numpy python2.7-dev If, for some reason, you're unable to get a working installation of numpy on your system, -you can add the define `WITHOUT_NUMPY` to erase this dependency. +you can define the macro `WITHOUT_NUMPY` before including the header file to erase this +dependency. The C++-part of the library consists of the single header file `matplotlibcpp.h` which can be placed anywhere. -Since a python interpreter is opened internally, it is necessary to link against `libpython2.7` in order to use -matplotlib-cpp. - -You can download and install matplotlib-cpp using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: - - git clone https://github.com/Microsoft/vcpkg.git - cd vcpkg - ./bootstrap-vcpkg.sh - ./vcpkg integrate install - vcpkg install matplotlib-cpp - -The matplotlib-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. +Since a python interpreter is opened internally, it is necessary to link against `libpython` in order +to user matplotlib-cpp. Most versions should work, although `libpython2.7` and `libpython3.6` are +probably the most regularly testedr. # CMake @@ -243,6 +235,20 @@ target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS}) target_link_libraries(myproject ${PYTHON_LIBRARIES}) ``` + +# Vcpkg + +You can download and install matplotlib-cpp using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + vcpkg install matplotlib-cpp + +The matplotlib-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + + # C++11 Currently, c++11 is required to build matplotlib-cpp. The last working commit that did From d74105036a82e6ccede3fa1a7d872ac1677b00ab Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Wed, 22 Apr 2020 00:28:08 +0200 Subject: [PATCH 51/86] Fix use-after-free bug when plotting unknown numeric types --- matplotlibcpp.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 55a04b1..c89a743 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -299,22 +299,24 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY template PyObject* get_array(const std::vector& v) { - detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work + detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work + npy_intp vsize = v.size(); NPY_TYPES type = select_npy_type::type; - if (type == NPY_NOTYPE) - { - std::vector vd(v.size()); - npy_intp vsize = v.size(); - std::copy(v.begin(),v.end(),vd.begin()); - PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, NPY_DOUBLE, (void*)(vd.data())); + if (type == NPY_NOTYPE) { + size_t memsize = v.size()*sizeof(double); + double* dp = static_cast(::malloc(memsize)); + for (size_t i=0; i(varray), NPY_ARRAY_OWNDATA); return varray; } - - npy_intp vsize = v.size(); + PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, type, (void*)(v.data())); return varray; } + template PyObject* get_2darray(const std::vector<::std::vector>& v) { From ecf3a8dd0bf2766c7988de8c6fbbb0098564f44d Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Wed, 22 Apr 2020 00:31:41 +0200 Subject: [PATCH 52/86] Add native numpy handling when plotting vectors of (unsigned) long long --- matplotlibcpp.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index c89a743..b83d8f0 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -296,6 +296,14 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY template <> struct select_npy_type { const static NPY_TYPES type = NPY_ULONG; }; template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; +// Sanity checks; comment them out or change the numpy type below if you're compiling on +// a platform where they don't apply +static_assert(sizeof(long long) == 8); +template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; +static_assert(sizeof(unsigned long long) == 8); +template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; +// TODO: add int, long, etc. + template PyObject* get_array(const std::vector& v) { From bf2be71082081ff3db96ab3ff1a00df7f99da92e Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 2 May 2020 16:55:08 +0200 Subject: [PATCH 53/86] Update python-config invocation in Makefile Since the new Ubuntu 20.04 LTS version is shipping python3.8 as the default python, update the Makefile to use that as default and more importantly fix the python-config invocation to work with all python versions. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 60e5f65..1a5a339 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,14 @@ CXXFLAGS += -std=c++11 -Wno-conversion # Default to using system's default version of python -PYTHON_BIN ?= python +PYTHON_BIN ?= python3 PYTHON_CONFIG := $(PYTHON_BIN)-config PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes) EXTRA_FLAGS := $(PYTHON_INCLUDE) -LDFLAGS += $(shell $(PYTHON_CONFIG) --libs) +# NOTE: Since python3.8, the correct invocation is `python3-config --libs --embed`. +# So of course the proper way to get python libs for embedding now is to +# invoke that, check if it crashes, and fall back to just `--libs` if it does. +LDFLAGS += $(shell if $(PYTHON_CONFIG) --libs --embed >/dev/null; then $(PYTHON_CONFIG) --libs --embed; else $(PYTHON_CONFIG) --libs; fi) # Either finds numpy or set -DWITHOUT_NUMPY EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) From f5f8ce3d6aa0c588e7f45346a0f89ad4f80991cf Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 2 May 2020 16:56:53 +0200 Subject: [PATCH 54/86] Move Python.h include into first position --- matplotlibcpp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index b83d8f0..0b7484b 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1,5 +1,9 @@ #pragma once +// Python headers must be included before any system headers, since +// they define _POSIX_C_SOURCE +#include + #include #include #include @@ -10,8 +14,6 @@ #include // requires c++11 support #include -#include - #ifndef WITHOUT_NUMPY # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION # include From d612b524e10ebdd43d3a8889a95e84c017ad65af Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Sat, 2 May 2020 16:57:26 +0200 Subject: [PATCH 55/86] Fix python3.8 segfault for the named_* family of functions The fix might be more widely required, but in particular python3.8 would segfault when PyUnicode_FromString() was called before the interpreter was initialized. Which is expected tbh, but a change in behaviour from earlier versions. --- matplotlibcpp.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 0b7484b..a03f4b9 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1174,6 +1174,9 @@ bool errorbar(const std::vector &x, const std::vector &y, co template bool named_plot(const std::string& name, const std::vector& y, const std::string& format = "") { + // Make sure python is initialized. + detail::_interpreter::get(); + PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); @@ -1198,6 +1201,9 @@ bool named_plot(const std::string& name, const std::vector& y, const st template bool named_plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + // Make sure python is initialized. + detail::_interpreter::get(); + PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); @@ -1223,6 +1229,9 @@ bool named_plot(const std::string& name, const std::vector& x, const st template bool named_semilogx(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + // Make sure python is initialized. + detail::_interpreter::get(); + PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); @@ -1248,6 +1257,9 @@ bool named_semilogx(const std::string& name, const std::vector& x, cons template bool named_semilogy(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + // Make sure python is initialized. + detail::_interpreter::get(); + PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); @@ -1273,6 +1285,9 @@ bool named_semilogy(const std::string& name, const std::vector& x, cons template bool named_loglog(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + // Make sure python is initialized. + detail::_interpreter::get(); + PyObject* kwargs = PyDict_New(); PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str())); From 60dcd64c8fd4766e5426f57decfb765422a1d3fe Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Tue, 12 May 2020 01:20:35 +0200 Subject: [PATCH 56/86] Sprinkle calls to interpreter::get() all over the codebase --- matplotlibcpp.h | 128 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 110 insertions(+), 18 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index a03f4b9..ea2e4fb 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -259,6 +259,8 @@ inline void backend(const std::string& name) inline bool annotate(std::string annotation, double x, double y) { + detail::_interpreter::get(); + PyObject * xy = PyTuple_New(2); PyObject * str = PyString_FromString(annotation.c_str()); @@ -309,7 +311,6 @@ template <> struct select_npy_type { const static NPY_TYPES template PyObject* get_array(const std::vector& v) { - detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work npy_intp vsize = v.size(); NPY_TYPES type = select_npy_type::type; if (type == NPY_NOTYPE) { @@ -330,7 +331,6 @@ PyObject* get_array(const std::vector& v) template PyObject* get_2darray(const std::vector<::std::vector>& v) { - detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work if (v.size() < 1) throw std::runtime_error("get_2d_array v too small"); npy_intp vsize[2] = {static_cast(v.size()), @@ -396,6 +396,8 @@ bool plot(const std::vector &x, const std::vector &y, const st { assert(x.size() == y.size()); + detail::_interpreter::get(); + // using numpy arrays PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -431,6 +433,8 @@ void plot_surface(const std::vector<::std::vector> &x, const std::map &keywords = std::map()) { + detail::_interpreter::get(); + // We lazily load the modules here the first time this function is called // because I'm not sure that we can assume "matplotlib installed" implies // "mpl_toolkits installed" on all platforms, and we don't want to require @@ -524,6 +528,8 @@ void plot3(const std::vector &x, const std::map &keywords = std::map()) { + detail::_interpreter::get(); + // Same as with plot_surface: We lazily load the modules here the first time // this function is called because I'm not sure that we can assume "matplotlib // installed" implies "mpl_toolkits installed" on all platforms, and we don't @@ -605,6 +611,8 @@ bool stem(const std::vector &x, const std::vector &y, const st { assert(x.size() == y.size()); + detail::_interpreter::get(); + // using numpy arrays PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -638,6 +646,8 @@ bool fill(const std::vector& x, const std::vector& y, const st { assert(x.size() == y.size()); + detail::_interpreter::get(); + // using numpy arrays PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -669,6 +679,8 @@ bool fill_between(const std::vector& x, const std::vector& y1, assert(x.size() == y1.size()); assert(x.size() == y2.size()); + detail::_interpreter::get(); + // using numpy arrays PyObject* xarray = detail::get_array(x); PyObject* y1array = detail::get_array(y1); @@ -699,6 +711,7 @@ template< typename Numeric> bool hist(const std::vector& y, long bins=10,std::string color="b", double alpha=1.0, bool cumulative=false) { + detail::_interpreter::get(); PyObject* yarray = detail::get_array(y); @@ -731,7 +744,7 @@ inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int co assert(type == NPY_UINT8 || type == NPY_FLOAT); assert(colors == 1 || colors == 3 || colors == 4); - detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work + detail::_interpreter::get(); // construct args npy_intp dims[3] = { rows, columns, colors }; @@ -806,6 +819,8 @@ bool scatter(const std::vector& x, const double s=1.0, // The marker size in points**2 const std::map & keywords = {}) { + detail::_interpreter::get(); + assert(x.size() == y.size()); PyObject* xarray = detail::get_array(x); @@ -836,6 +851,8 @@ bool boxplot(const std::vector>& data, const std::vector& labels = {}, const std::map & keywords = {}) { + detail::_interpreter::get(); + PyObject* listlist = detail::get_listlist(data); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, listlist); @@ -867,6 +884,8 @@ template bool boxplot(const std::vector& data, const std::map & keywords = {}) { + detail::_interpreter::get(); + PyObject* vector = detail::get_array(data); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, vector); @@ -893,7 +912,10 @@ bool bar(const std::vector & x, std::string ec = "black", std::string ls = "-", double lw = 1.0, - const std::map & keywords = {}) { + const std::map & keywords = {}) +{ + detail::_interpreter::get(); + PyObject * xarray = detail::get_array(x); PyObject * yarray = detail::get_array(y); @@ -930,9 +952,12 @@ bool bar(const std::vector & y, std::string ec = "black", std::string ls = "-", double lw = 1.0, - const std::map & keywords = {}) { + const std::map & keywords = {}) +{ using T = typename std::remove_reference::type::value_type; + detail::_interpreter::get(); + std::vector x; for (std::size_t i = 0; i < y.size(); i++) { x.push_back(i); } @@ -941,6 +966,7 @@ bool bar(const std::vector & y, inline bool subplots_adjust(const std::map& keywords = {}) { + detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); for (std::map::const_iterator it = @@ -964,6 +990,8 @@ inline bool subplots_adjust(const std::map& keywords = {}) template< typename Numeric> bool named_hist(std::string label,const std::vector& y, long bins=10, std::string color="b", double alpha=1.0) { + detail::_interpreter::get(); + PyObject* yarray = detail::get_array(y); PyObject* kwargs = PyDict_New(); @@ -990,6 +1018,8 @@ bool plot(const std::vector& x, const std::vector& y, const { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -1013,6 +1043,8 @@ bool quiver(const std::vector& x, const std::vector& y, cons { assert(x.size() == y.size() && x.size() == u.size() && u.size() == w.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); PyObject* uarray = detail::get_array(u); @@ -1047,6 +1079,8 @@ bool stem(const std::vector& x, const std::vector& y, const { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -1072,6 +1106,8 @@ bool semilogx(const std::vector& x, const std::vector& y, co { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -1095,6 +1131,8 @@ bool semilogy(const std::vector& x, const std::vector& y, co { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -1118,6 +1156,8 @@ bool loglog(const std::vector& x, const std::vector& y, cons { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); @@ -1141,6 +1181,8 @@ bool errorbar(const std::vector &x, const std::vector &y, co { assert(x.size() == y.size()); + detail::_interpreter::get(); + PyObject* xarray = detail::get_array(x); PyObject* yarray = detail::get_array(y); PyObject* yerrarray = detail::get_array(yerr); @@ -1174,7 +1216,6 @@ bool errorbar(const std::vector &x, const std::vector &y, co template bool named_plot(const std::string& name, const std::vector& y, const std::string& format = "") { - // Make sure python is initialized. detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); @@ -1201,7 +1242,6 @@ bool named_plot(const std::string& name, const std::vector& y, const st template bool named_plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { - // Make sure python is initialized. detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); @@ -1229,7 +1269,6 @@ bool named_plot(const std::string& name, const std::vector& x, const st template bool named_semilogx(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { - // Make sure python is initialized. detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); @@ -1257,7 +1296,6 @@ bool named_semilogx(const std::string& name, const std::vector& x, cons template bool named_semilogy(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { - // Make sure python is initialized. detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); @@ -1285,7 +1323,6 @@ bool named_semilogy(const std::string& name, const std::vector& x, cons template bool named_loglog(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { - // Make sure python is initialized. detail::_interpreter::get(); PyObject* kwargs = PyDict_New(); @@ -1336,6 +1373,8 @@ bool stem(const std::vector& y, const std::string& format = "") template void text(Numeric x, Numeric y, const std::string& s = "") { + detail::_interpreter::get(); + PyObject* args = PyTuple_New(3); PyTuple_SetItem(args, 0, PyFloat_FromDouble(x)); PyTuple_SetItem(args, 1, PyFloat_FromDouble(y)); @@ -1352,6 +1391,9 @@ inline void colorbar(PyObject* mappable = NULL, const std::map void ylim(Numeric left, Numeric right) { + detail::_interpreter::get(); + PyObject* list = PyList_New(2); PyList_SetItem(list, 0, PyFloat_FromDouble(left)); PyList_SetItem(list, 1, PyFloat_FromDouble(right)); @@ -1467,6 +1513,8 @@ void ylim(Numeric left, Numeric right) template void xlim(Numeric left, Numeric right) { + detail::_interpreter::get(); + PyObject* list = PyList_New(2); PyList_SetItem(list, 0, PyFloat_FromDouble(left)); PyList_SetItem(list, 1, PyFloat_FromDouble(right)); @@ -1484,6 +1532,8 @@ void xlim(Numeric left, Numeric right) inline double* xlim() { + detail::_interpreter::get(); + PyObject* args = PyTuple_New(0); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_xlim, args); PyObject* left = PyTuple_GetItem(res,0); @@ -1502,6 +1552,8 @@ inline double* xlim() inline double* ylim() { + detail::_interpreter::get(); + PyObject* args = PyTuple_New(0); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_ylim, args); PyObject* left = PyTuple_GetItem(res,0); @@ -1522,6 +1574,8 @@ inline void xticks(const std::vector &ticks, const std::vector &ticks, const std::vector &ticks, const std::map& keywords, const std::string axis = "both") { + detail::_interpreter::get(); + // construct positional args PyObject* args; args = PyTuple_New(1); @@ -1637,7 +1695,6 @@ inline void tick_params(const std::map& keywords, cons inline void subplot(long nrows, long ncols, long plot_number) { - // Make sure interpreter is initialized detail::_interpreter::get(); // construct positional args @@ -1655,6 +1712,8 @@ inline void subplot(long nrows, long ncols, long plot_number) inline void subplot2grid(long nrows, long ncols, long rowid=0, long colid=0, long rowspan=1, long colspan=1) { + detail::_interpreter::get(); + PyObject* shape = PyTuple_New(2); PyTuple_SetItem(shape, 0, PyLong_FromLong(nrows)); PyTuple_SetItem(shape, 1, PyLong_FromLong(ncols)); @@ -1680,6 +1739,8 @@ inline void subplot2grid(long nrows, long ncols, long rowid=0, long colid=0, lon inline void title(const std::string &titlestr, const std::map &keywords = {}) { + detail::_interpreter::get(); + PyObject* pytitlestr = PyString_FromString(titlestr.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pytitlestr); @@ -1699,7 +1760,6 @@ inline void title(const std::string &titlestr, const std::map &keywords = {}) { - // Make sure interpreter is initialized detail::_interpreter::get(); PyObject* pysuptitlestr = PyString_FromString(suptitlestr.c_str()); @@ -1721,6 +1781,8 @@ inline void suptitle(const std::string &suptitlestr, const std::map& keywords = std::map()) { + detail::_interpreter::get(); + // construct positional args PyObject* args = PyTuple_New(3); PyTuple_SetItem(args, 0, PyFloat_FromDouble(x)); @@ -1757,6 +1821,8 @@ inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map inline void xlabel(const std::string &str, const std::map &keywords = {}) { + detail::_interpreter::get(); + PyObject* pystr = PyString_FromString(str.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pystr); @@ -1776,6 +1842,8 @@ inline void xlabel(const std::string &str, const std::map& keywords = {}) { + detail::_interpreter::get(); + PyObject* pystr = PyString_FromString(str.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pystr); @@ -1793,15 +1861,16 @@ inline void ylabel(const std::string &str, const std::map& keywords = {}) { +inline void set_zlabel(const std::string &str, const std::map& keywords = {}) +{ + detail::_interpreter::get(); + // Same as with plot_surface: We lazily load the modules here the first time // this function is called because I'm not sure that we can assume "matplotlib // installed" implies "mpl_toolkits installed" on all platforms, and we don't // want to require it for people who don't need 3d plots. static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; if (!mpl_toolkitsmod) { - detail::_interpreter::get(); - PyObject* mpl_toolkits = PyString_FromString("mpl_toolkits"); PyObject* axis3d = PyString_FromString("mpl_toolkits.mplot3d"); if (!mpl_toolkits || !axis3d) { throw std::runtime_error("couldnt create string"); } @@ -1846,6 +1915,8 @@ inline void set_zlabel(const std::string &str, const std::map inline void pause(Numeric interval) { + detail::_interpreter::get(); + PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, PyFloat_FromDouble(interval)); @@ -1934,6 +2015,8 @@ inline void pause(Numeric interval) inline void save(const std::string& filename) { + detail::_interpreter::get(); + PyObject* pyfilename = PyString_FromString(filename.c_str()); PyObject* args = PyTuple_New(1); @@ -1947,6 +2030,8 @@ inline void save(const std::string& filename) } inline void clf() { + detail::_interpreter::get(); + PyObject *res = PyObject_CallObject( detail::_interpreter::get().s_python_function_clf, detail::_interpreter::get().s_python_empty_tuple); @@ -1956,7 +2041,9 @@ inline void clf() { Py_DECREF(res); } - inline void ion() { +inline void ion() { + detail::_interpreter::get(); + PyObject *res = PyObject_CallObject( detail::_interpreter::get().s_python_function_ion, detail::_interpreter::get().s_python_empty_tuple); @@ -1968,6 +2055,8 @@ inline void clf() { inline std::vector> ginput(const int numClicks = 1, const std::map& keywords = {}) { + detail::_interpreter::get(); + PyObject *args = PyTuple_New(1); PyTuple_SetItem(args, 0, PyLong_FromLong(numClicks)); @@ -2002,6 +2091,8 @@ inline std::vector> ginput(const int numClicks = 1, const // Actually, is there any reason not to call this automatically for every plot? inline void tight_layout() { + detail::_interpreter::get(); + PyObject *res = PyObject_CallObject( detail::_interpreter::get().s_python_function_tight_layout, detail::_interpreter::get().s_python_empty_tuple); @@ -2149,6 +2240,7 @@ class Plot // default initialization with plot label, some data and format template Plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { + detail::_interpreter::get(); assert(x.size() == y.size()); From 480af0f4f9d13dd62254981855e7bc1a11378dbc Mon Sep 17 00:00:00 2001 From: pf Date: Mon, 20 Apr 2020 10:29:54 +0100 Subject: [PATCH 57/86] Added support for axvspan --- matplotlibcpp.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index ea2e4fb..6cbe74f 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -73,6 +73,7 @@ struct _interpreter { PyObject *s_python_function_title; PyObject *s_python_function_axis; PyObject *s_python_function_axvline; + PyObject *s_python_function_axvspan; PyObject *s_python_function_xlabel; PyObject *s_python_function_ylabel; PyObject *s_python_function_gca; @@ -208,6 +209,7 @@ struct _interpreter { s_python_function_title = safe_import(pymod, "title"); s_python_function_axis = safe_import(pymod, "axis"); s_python_function_axvline = safe_import(pymod, "axvline"); + s_python_function_axvspan = safe_import(pymod, "axvspan"); s_python_function_xlabel = safe_import(pymod, "xlabel"); s_python_function_ylabel = safe_import(pymod, "ylabel"); s_python_function_gca = safe_import(pymod, "gca"); @@ -1819,6 +1821,29 @@ inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map if(res) Py_DECREF(res); } +inline void axvspan(double xmin, double xmax, double ymin = 0., double ymax = 1., const std::map& keywords = std::map()) +{ + // construct positional args + PyObject* args = PyTuple_New(4); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(xmin)); + PyTuple_SetItem(args, 1, PyFloat_FromDouble(xmax)); + PyTuple_SetItem(args, 2, PyFloat_FromDouble(ymin)); + PyTuple_SetItem(args, 3, PyFloat_FromDouble(ymax)); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axvspan, args, kwargs); + Py_DECREF(args); + Py_DECREF(kwargs); + + if(res) Py_DECREF(res); +} + inline void xlabel(const std::string &str, const std::map &keywords = {}) { detail::_interpreter::get(); From 107912124d9d6a0a6942b2b2153c781905e83854 Mon Sep 17 00:00:00 2001 From: pf Date: Mon, 20 Apr 2020 10:49:19 +0100 Subject: [PATCH 58/86] a few of the parameters are floats. This is a quick hack to get a couple of them to work. In the future matplotlibcpp should use map instead of map for kwargs. That should be a separate PR --- matplotlibcpp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 6cbe74f..b4bf18a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1834,7 +1834,10 @@ inline void axvspan(double xmin, double xmax, double ymin = 0., double ymax = 1. PyObject* kwargs = PyDict_New(); for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { - PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + if (it->first == "linewidth" || it->first == "alpha") + PyDict_SetItemString(kwargs, it->first.c_str(), PyFloat_FromDouble(std::stod(it->second))); + else + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); } PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axvspan, args, kwargs); From 374dcd032ca8e609d25ba7ced2dd3f25a173fabb Mon Sep 17 00:00:00 2001 From: JBPennington Date: Fri, 24 Apr 2020 08:58:15 -0400 Subject: [PATCH 59/86] Added arrow, cla, margins, contour --- matplotlibcpp.h | 116 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index b4bf18a..7460eb7 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -45,6 +45,7 @@ namespace detail { static std::string s_backend; struct _interpreter { + PyObject* s_python_function_arrow; PyObject *s_python_function_show; PyObject *s_python_function_close; PyObject *s_python_function_draw; @@ -54,6 +55,7 @@ struct _interpreter { PyObject *s_python_function_fignum_exists; PyObject *s_python_function_plot; PyObject *s_python_function_quiver; + PyObject* s_python_function_contour; PyObject *s_python_function_semilogx; PyObject *s_python_function_semilogy; PyObject *s_python_function_loglog; @@ -79,8 +81,10 @@ struct _interpreter { PyObject *s_python_function_gca; PyObject *s_python_function_xticks; PyObject *s_python_function_yticks; + PyObject* s_python_function_margins; PyObject *s_python_function_tick_params; PyObject *s_python_function_grid; + PyObject* s_python_function_cla; PyObject *s_python_function_clf; PyObject *s_python_function_errorbar; PyObject *s_python_function_annotate; @@ -186,6 +190,7 @@ struct _interpreter { Py_DECREF(pylabname); if (!pylabmod) { throw std::runtime_error("Error loading module pylab!"); } + s_python_function_arrow = safe_import(pymod, "arrow"); s_python_function_show = safe_import(pymod, "show"); s_python_function_close = safe_import(pymod, "close"); s_python_function_draw = safe_import(pymod, "draw"); @@ -194,6 +199,7 @@ struct _interpreter { s_python_function_fignum_exists = safe_import(pymod, "fignum_exists"); s_python_function_plot = safe_import(pymod, "plot"); s_python_function_quiver = safe_import(pymod, "quiver"); + s_python_function_contour = safe_import(pymod, "contour"); s_python_function_semilogx = safe_import(pymod, "semilogx"); s_python_function_semilogy = safe_import(pymod, "semilogy"); s_python_function_loglog = safe_import(pymod, "loglog"); @@ -215,6 +221,7 @@ struct _interpreter { s_python_function_gca = safe_import(pymod, "gca"); s_python_function_xticks = safe_import(pymod, "xticks"); s_python_function_yticks = safe_import(pymod, "yticks"); + s_python_function_margins = safe_import(pymod, "margins"); s_python_function_tick_params = safe_import(pymod, "tick_params"); s_python_function_grid = safe_import(pymod, "grid"); s_python_function_xlim = safe_import(pymod, "xlim"); @@ -222,6 +229,7 @@ struct _interpreter { s_python_function_ginput = safe_import(pymod, "ginput"); s_python_function_save = safe_import(pylabmod, "savefig"); s_python_function_annotate = safe_import(pymod,"annotate"); + s_python_function_cla = safe_import(pymod, "cla"); s_python_function_clf = safe_import(pymod, "clf"); s_python_function_errorbar = safe_import(pymod, "errorbar"); s_python_function_tight_layout = safe_import(pymod, "tight_layout"); @@ -709,6 +717,37 @@ bool fill_between(const std::vector& x, const std::vector& y1, return res; } +template +bool arrow(Numeric x, Numeric y, Numeric end_x, Numeric end_y, const std::string& fc = "r", + const std::string ec = "k", Numeric head_length = 0.25, Numeric head_width = 0.1625) { + PyObject* obj_x = PyFloat_FromDouble(x); + PyObject* obj_y = PyFloat_FromDouble(y); + PyObject* obj_end_x = PyFloat_FromDouble(end_x); + PyObject* obj_end_y = PyFloat_FromDouble(end_y); + + PyObject* kwargs = PyDict_New(); + PyDict_SetItemString(kwargs, "fc", PyString_FromString(fc.c_str())); + PyDict_SetItemString(kwargs, "ec", PyString_FromString(ec.c_str())); + PyDict_SetItemString(kwargs, "head_width", PyFloat_FromDouble(head_width)); + PyDict_SetItemString(kwargs, "head_length", PyFloat_FromDouble(head_length)); + + PyObject* plot_args = PyTuple_New(4); + PyTuple_SetItem(plot_args, 0, obj_x); + PyTuple_SetItem(plot_args, 1, obj_y); + PyTuple_SetItem(plot_args, 2, obj_end_x); + PyTuple_SetItem(plot_args, 3, obj_end_y); + + PyObject* res = + PyObject_Call(detail::_interpreter::get().s_python_function_arrow, plot_args, kwargs); + + Py_DECREF(plot_args); + Py_DECREF(kwargs); + if (res) + Py_DECREF(res); + + return res; +} + template< typename Numeric> bool hist(const std::vector& y, long bins=10,std::string color="b", double alpha=1.0, bool cumulative=false) @@ -1040,6 +1079,39 @@ bool plot(const std::vector& x, const std::vector& y, const return res; } +template +bool contour(const std::vector& x, const std::vector& y, + const std::vector& z, + const std::map& keywords = {}) { + assert(x.size() == y.size() && x.size() == z.size()); + + PyObject* xarray = get_array(x); + PyObject* yarray = get_array(y); + PyObject* zarray = get_array(z); + + PyObject* plot_args = PyTuple_New(3); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + PyTuple_SetItem(plot_args, 2, zarray); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for (std::map::const_iterator it = keywords.begin(); + it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject* res = + PyObject_Call(detail::_interpreter::get().s_python_function_contour, plot_args, kwargs); + + Py_DECREF(kwargs); + Py_DECREF(plot_args); + if (res) + Py_DECREF(res); + + return res; +} + template bool quiver(const std::vector& x, const std::vector& y, const std::vector& u, const std::vector& w, const std::map& keywords = {}) { @@ -1669,6 +1741,38 @@ inline void yticks(const std::vector &ticks, const std::map inline void margins(Numeric margin) +{ + // construct positional args + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(margin)); + + PyObject* res = + PyObject_CallObject(detail::_interpreter::get().s_python_function_margins, args); + if (!res) + throw std::runtime_error("Call to margins() failed."); + + Py_DECREF(args); + Py_DECREF(res); +} + +template inline void margins(Numeric margin_x, Numeric margin_y) +{ + // construct positional args + PyObject* args = PyTuple_New(2); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(margin_x)); + PyTuple_SetItem(args, 1, PyFloat_FromDouble(margin_y)); + + PyObject* res = + PyObject_CallObject(detail::_interpreter::get().s_python_function_margins, args); + if (!res) + throw std::runtime_error("Call to margins() failed."); + + Py_DECREF(args); + Py_DECREF(res); +} + + inline void tick_params(const std::map& keywords, const std::string axis = "both") { detail::_interpreter::get(); @@ -2069,6 +2173,18 @@ inline void clf() { Py_DECREF(res); } +inline void cla() { + detail::_interpreter::get(); + + PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_cla, + detail::_interpreter::get().s_python_empty_tuple); + + if (!res) + throw std::runtime_error("Call to cla() failed."); + + Py_DECREF(res); +} + inline void ion() { detail::_interpreter::get(); From b79ca6dc655f01eac206b84d3c7ffc7cdb268107 Mon Sep 17 00:00:00 2001 From: Tako Hisada Date: Sun, 14 Jun 2020 21:38:22 +0000 Subject: [PATCH 60/86] feat: Add keyword argument support to legend() --- matplotlibcpp.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 7460eb7..6770074 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1565,6 +1565,24 @@ inline void legend() Py_DECREF(res); } +inline void legend(const std::map& keywords) +{ + detail::_interpreter::get(); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_legend, detail::_interpreter::get().s_python_empty_tuple, kwargs); + if(!res) throw std::runtime_error("Call to legend() failed."); + + Py_DECREF(kwargs); + Py_DECREF(res); +} + template void ylim(Numeric left, Numeric right) { From 7d0e695409e7029fd52a4653907a167b4cc725b9 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Sat, 23 May 2020 19:04:01 +0200 Subject: [PATCH 61/86] include ldflags instead of libs --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1a5a339..67b5ac3 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,10 @@ PYTHON_BIN ?= python3 PYTHON_CONFIG := $(PYTHON_BIN)-config PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes) EXTRA_FLAGS := $(PYTHON_INCLUDE) -# NOTE: Since python3.8, the correct invocation is `python3-config --libs --embed`. +# NOTE: Since python3.8, the correct invocation is `python3-config --libs --embed`. # So of course the proper way to get python libs for embedding now is to # invoke that, check if it crashes, and fall back to just `--libs` if it does. -LDFLAGS += $(shell if $(PYTHON_CONFIG) --libs --embed >/dev/null; then $(PYTHON_CONFIG) --libs --embed; else $(PYTHON_CONFIG) --libs; fi) +LDFLAGS += $(shell if $(PYTHON_CONFIG) --ldflags --embed >/dev/null; then $(PYTHON_CONFIG) --ldflags --embed; else $(PYTHON_CONFIG) --ldflags; fi) # Either finds numpy or set -DWITHOUT_NUMPY EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) From f4b49a35d0bc59bb2fd606b1f7c9bedf9c271e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9=20BALP?= Date: Sat, 15 Aug 2020 20:02:15 +0000 Subject: [PATCH 62/86] Fix issue lava/matplotlib-cpp#124 --- matplotlibcpp.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 6770074..98f356c 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -153,6 +153,11 @@ struct _interpreter { Py_SetProgramName(name); Py_Initialize(); + wchar_t const *dummy_args[] = {L"Python", NULL}; // const is needed because literals must not be modified + wchar_t const **argv = dummy_args; + int argc = sizeof(dummy_args)/sizeof(dummy_args[0])-1; + PySys_SetArgv(argc, const_cast(argv)); + #ifndef WITHOUT_NUMPY import_numpy(); // initialize numpy C-API #endif From f2bf7a45112d1d9e41cf97ceb645f106e80f6442 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Thu, 27 Aug 2020 20:50:30 +0200 Subject: [PATCH 63/86] Add missing call to initialize interpreter in 'modern' example --- matplotlibcpp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 98f356c..111b904 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -2321,6 +2321,8 @@ struct plot_impl template bool operator()(const IterableX& x, const IterableY& y, const std::string& format) { + detail::_interpreter::get(); + // 2-phase lookup for distance, begin, end using std::distance; using std::begin; From 6f841d442aebbd22f80eb70c9e0d1fbc590c7638 Mon Sep 17 00:00:00 2001 From: Andre Furlan Date: Tue, 26 May 2020 15:53:17 -0300 Subject: [PATCH 64/86] Added support to barh plot method --- matplotlibcpp.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 111b904..c6762db 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -96,6 +96,7 @@ struct _interpreter { PyObject *s_python_function_text; PyObject *s_python_function_suptitle; PyObject *s_python_function_bar; + PyObject *s_python_function_barh; PyObject *s_python_function_colorbar; PyObject *s_python_function_subplots_adjust; @@ -243,6 +244,7 @@ struct _interpreter { s_python_function_text = safe_import(pymod, "text"); s_python_function_suptitle = safe_import(pymod, "suptitle"); s_python_function_bar = safe_import(pymod,"bar"); + s_python_function_barh = safe_import(pymod, "barh"); s_python_function_colorbar = PyObject_GetAttrString(pymod, "colorbar"); s_python_function_subplots_adjust = safe_import(pymod,"subplots_adjust"); #ifndef WITHOUT_NUMPY @@ -1010,6 +1012,36 @@ bool bar(const std::vector & y, return bar(x, y, ec, ls, lw, keywords); } + +template +bool barh(const std::vector &x, const std::vector &y, std::string ec = "black", std::string ls = "-", double lw = 1.0, const std::map &keywords = { }) { + PyObject *xarray = detail::get_array(x); + PyObject *yarray = detail::get_array(y); + + PyObject *kwargs = PyDict_New(); + + PyDict_SetItemString(kwargs, "ec", PyString_FromString(ec.c_str())); + PyDict_SetItemString(kwargs, "ls", PyString_FromString(ls.c_str())); + PyDict_SetItemString(kwargs, "lw", PyFloat_FromDouble(lw)); + + for (std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + PyObject *plot_args = PyTuple_New(2); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + + PyObject *res = PyObject_Call(detail::_interpreter::get().s_python_function_barh, plot_args, kwargs); + + Py_DECREF(plot_args); + Py_DECREF(kwargs); + if (res) Py_DECREF(res); + + return res; +} + + inline bool subplots_adjust(const std::map& keywords = {}) { detail::_interpreter::get(); From dfe5a69a950251887f8b8754023e7fc23d8da6fc Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Thu, 27 Aug 2020 21:18:02 +0200 Subject: [PATCH 65/86] Fix whitespace error --- matplotlibcpp.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index c6762db..9b414a1 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1993,10 +1993,10 @@ inline void axvspan(double xmin, double xmax, double ymin = 0., double ymax = 1. PyObject* kwargs = PyDict_New(); for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { - if (it->first == "linewidth" || it->first == "alpha") - PyDict_SetItemString(kwargs, it->first.c_str(), PyFloat_FromDouble(std::stod(it->second))); - else - PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + if (it->first == "linewidth" || it->first == "alpha") + PyDict_SetItemString(kwargs, it->first.c_str(), PyFloat_FromDouble(std::stod(it->second))); + else + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); } PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axvspan, args, kwargs); From b6f58a5c4c0a1430c7ec92e2583b817309650d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=20creepeur=20petit=C3=A8?= Date: Thu, 18 Jun 2020 07:20:46 +0300 Subject: [PATCH 66/86] Suggestion: Give more multithreading flexibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Python interpreter can be constructed by any thread while the destructor is always the main thread. This can lead in some errors with the Python side of things, where some objects want the thread which constructed them to also destroy them. By adding this 'kill' function, a developer can use your library (btw gj! 👍 ) with `std::thread` in order to create a plot async -aka without blocking the main thread- and then close the plot and 'kill' Python interpreter afterwards, without waiting the program to end or having destructor errors. Doing this in order to showcase this more. Small change but not that polished. Let me know about your opinion first and we can fix it 😃. Thank you for your time and this great library ❤️ --- matplotlibcpp.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 9b414a1..714bfd3 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -108,7 +108,17 @@ struct _interpreter { */ static _interpreter& get() { + return interkeeper(false); + } + + static _interpreter& kill() { + return interkeeper(true); + } + + static _interpreter& interkeeper(bool should_kill) { static _interpreter ctx; + if (should_kill) + ctx.~_interpreter(); return ctx; } From 70d508fcb7febc66535ba923eac1b1a4e571e4d1 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Thu, 27 Aug 2020 21:29:25 +0200 Subject: [PATCH 67/86] Expand comment for new interkeeper() function --- matplotlibcpp.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 714bfd3..93a72be 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -103,8 +103,14 @@ struct _interpreter { /* For now, _interpreter is implemented as a singleton since its currently not possible to have multiple independent embedded python interpreters without patching the python source code - or starting a separate process for each. - http://bytes.com/topic/python/answers/793370-multiple-independent-python-interpreters-c-c-program + or starting a separate process for each. [1] + Furthermore, many python objects expect that they are destructed in the same thread as they + were constructed. [2] So for advanced usage, a `kill()` function is provided so that library + users can manually ensure that the interpreter is constructed and destroyed within the + same thread. + + 1: http://bytes.com/topic/python/answers/793370-multiple-independent-python-interpreters-c-c-program + 2: https://github.com/lava/matplotlib-cpp/pull/202#issue-436220256 */ static _interpreter& get() { @@ -115,6 +121,7 @@ struct _interpreter { return interkeeper(true); } + // Stores the actual singleton object referenced by `get()` and `kill()`. static _interpreter& interkeeper(bool should_kill) { static _interpreter ctx; if (should_kill) From 80bc9cd84da8d40f9b52b838291eb91f00c1c73f Mon Sep 17 00:00:00 2001 From: Joshua Brinsfield Date: Sat, 31 Oct 2020 18:51:05 -0400 Subject: [PATCH 68/86] Add 3D quiver support --- matplotlibcpp.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 93a72be..52b2780 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1202,6 +1202,92 @@ bool quiver(const std::vector& x, const std::vector& y, cons return res; } +template +bool quiver(const std::vector& x, const std::vector& y, const std::vector& z, const std::vector& u, const std::vector& w, const std::vector& v, const std::map& keywords = {}) +{ + //set up 3d axes stuff + static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; + if (!mpl_toolkitsmod) { + detail::_interpreter::get(); + + PyObject* mpl_toolkits = PyString_FromString("mpl_toolkits"); + PyObject* axis3d = PyString_FromString("mpl_toolkits.mplot3d"); + if (!mpl_toolkits || !axis3d) { throw std::runtime_error("couldnt create string"); } + + mpl_toolkitsmod = PyImport_Import(mpl_toolkits); + Py_DECREF(mpl_toolkits); + if (!mpl_toolkitsmod) { throw std::runtime_error("Error loading module mpl_toolkits!"); } + + axis3dmod = PyImport_Import(axis3d); + Py_DECREF(axis3d); + if (!axis3dmod) { throw std::runtime_error("Error loading module mpl_toolkits.mplot3d!"); } + } + + //assert sizes match up + assert(x.size() == y.size() && x.size() == u.size() && u.size() == w.size() && x.size() == z.size() && x.size() == v.size() && u.size() == v.size()); + + //set up parameters + detail::_interpreter::get(); + + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); + PyObject* zarray = detail::get_array(z); + PyObject* uarray = detail::get_array(u); + PyObject* warray = detail::get_array(w); + PyObject* varray = detail::get_array(v); + + PyObject* plot_args = PyTuple_New(6); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + PyTuple_SetItem(plot_args, 2, zarray); + PyTuple_SetItem(plot_args, 3, uarray); + PyTuple_SetItem(plot_args, 4, warray); + PyTuple_SetItem(plot_args, 5, varray); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyUnicode_FromString(it->second.c_str())); + } + + //get figure gca to enable 3d projection + PyObject *fig = + PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + detail::_interpreter::get().s_python_empty_tuple); + if (!fig) throw std::runtime_error("Call to figure() failed."); + + PyObject *gca_kwargs = PyDict_New(); + PyDict_SetItemString(gca_kwargs, "projection", PyString_FromString("3d")); + + PyObject *gca = PyObject_GetAttrString(fig, "gca"); + if (!gca) throw std::runtime_error("No gca"); + Py_INCREF(gca); + PyObject *axis = PyObject_Call( + gca, detail::_interpreter::get().s_python_empty_tuple, gca_kwargs); + + if (!axis) throw std::runtime_error("No axis"); + Py_INCREF(axis); + Py_DECREF(gca); + Py_DECREF(gca_kwargs); + + //plot our boys bravely, plot them strongly, plot them with a wink and clap + PyObject *plot3 = PyObject_GetAttrString(axis, "quiver"); + if (!plot3) throw std::runtime_error("No 3D line plot"); + Py_INCREF(plot3); + PyObject* res = PyObject_Call( + plot3, plot_args, kwargs); + if (!res) throw std::runtime_error("Failed 3D plot"); + Py_DECREF(plot3); + Py_DECREF(axis); + Py_DECREF(kwargs); + Py_DECREF(plot_args); + if (res) + Py_DECREF(res); + + return res; +} + template bool stem(const std::vector& x, const std::vector& y, const std::string& s = "") { From 9d19657a36c3950de2848113a546406cad8f8f29 Mon Sep 17 00:00:00 2001 From: Ruan Luies Date: Sun, 17 Jan 2021 13:30:12 +0200 Subject: [PATCH 69/86] Add 3D scatter plots, allow more than one 3d plot on the same figure and make rcparams changeable. --- matplotlibcpp.h | 185 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 167 insertions(+), 18 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 52b2780..226a16a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -99,6 +99,7 @@ struct _interpreter { PyObject *s_python_function_barh; PyObject *s_python_function_colorbar; PyObject *s_python_function_subplots_adjust; + PyObject *s_python_function_rcparams; /* For now, _interpreter is implemented as a singleton since its currently not possible to have @@ -189,6 +190,7 @@ struct _interpreter { } PyObject* matplotlib = PyImport_Import(matplotlibname); + Py_DECREF(matplotlibname); if (!matplotlib) { PyErr_Print(); @@ -201,6 +203,8 @@ struct _interpreter { PyObject_CallMethod(matplotlib, const_cast("use"), const_cast("s"), s_backend.c_str()); } + + PyObject* pymod = PyImport_Import(pyplotname); Py_DECREF(pyplotname); if (!pymod) { throw std::runtime_error("Error loading module matplotlib.pyplot!"); } @@ -264,6 +268,7 @@ struct _interpreter { s_python_function_barh = safe_import(pymod, "barh"); s_python_function_colorbar = PyObject_GetAttrString(pymod, "colorbar"); s_python_function_subplots_adjust = safe_import(pymod,"subplots_adjust"); + s_python_function_rcparams = PyObject_GetAttrString(pymod, "rcParams"); #ifndef WITHOUT_NUMPY s_python_function_imshow = safe_import(pymod, "imshow"); #endif @@ -464,6 +469,7 @@ template void plot_surface(const std::vector<::std::vector> &x, const std::vector<::std::vector> &y, const std::vector<::std::vector> &z, + const long fig_number=0, const std::map &keywords = std::map()) { @@ -516,14 +522,29 @@ void plot_surface(const std::vector<::std::vector> &x, for (std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { - PyDict_SetItemString(kwargs, it->first.c_str(), - PyString_FromString(it->second.c_str())); + if (it->first == "linewidth" || it->first == "alpha") { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyFloat_FromDouble(std::stod(it->second))); + } else { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } } - - PyObject *fig = - PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, - detail::_interpreter::get().s_python_empty_tuple); + PyObject *fig_args = PyTuple_New(1); + PyObject* fig = nullptr; + PyTuple_SetItem(fig_args, 0, PyLong_FromLong(fig_number)); + PyObject *fig_exists = + PyObject_CallObject( + detail::_interpreter::get().s_python_function_fignum_exists, fig_args); + if (!PyObject_IsTrue(fig_exists)) { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + detail::_interpreter::get().s_python_empty_tuple); + } else { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + fig_args); + } + Py_DECREF(fig_exists); if (!fig) throw std::runtime_error("Call to figure() failed."); PyObject *gca_kwargs = PyDict_New(); @@ -559,6 +580,7 @@ template void plot3(const std::vector &x, const std::vector &y, const std::vector &z, + const long fig_number=0, const std::map &keywords = std::map()) { @@ -607,9 +629,18 @@ void plot3(const std::vector &x, PyString_FromString(it->second.c_str())); } - PyObject *fig = - PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, - detail::_interpreter::get().s_python_empty_tuple); + PyObject *fig_args = PyTuple_New(1); + PyObject* fig = nullptr; + PyTuple_SetItem(fig_args, 0, PyLong_FromLong(fig_number)); + PyObject *fig_exists = + PyObject_CallObject(detail::_interpreter::get().s_python_function_fignum_exists, fig_args); + if (!PyObject_IsTrue(fig_exists)) { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + detail::_interpreter::get().s_python_empty_tuple); + } else { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + fig_args); + } if (!fig) throw std::runtime_error("Call to figure() failed."); PyObject *gca_kwargs = PyDict_New(); @@ -911,6 +942,103 @@ bool scatter(const std::vector& x, return res; } +template +bool scatter(const std::vector& x, + const std::vector& y, + const std::vector& z, + const double s=1.0, // The marker size in points**2 + const long fig_number=0, + const std::map & keywords = {}) { + detail::_interpreter::get(); + + // Same as with plot_surface: We lazily load the modules here the first time + // this function is called because I'm not sure that we can assume "matplotlib + // installed" implies "mpl_toolkits installed" on all platforms, and we don't + // want to require it for people who don't need 3d plots. + static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; + if (!mpl_toolkitsmod) { + detail::_interpreter::get(); + + PyObject* mpl_toolkits = PyString_FromString("mpl_toolkits"); + PyObject* axis3d = PyString_FromString("mpl_toolkits.mplot3d"); + if (!mpl_toolkits || !axis3d) { throw std::runtime_error("couldnt create string"); } + + mpl_toolkitsmod = PyImport_Import(mpl_toolkits); + Py_DECREF(mpl_toolkits); + if (!mpl_toolkitsmod) { throw std::runtime_error("Error loading module mpl_toolkits!"); } + + axis3dmod = PyImport_Import(axis3d); + Py_DECREF(axis3d); + if (!axis3dmod) { throw std::runtime_error("Error loading module mpl_toolkits.mplot3d!"); } + } + + assert(x.size() == y.size()); + assert(y.size() == z.size()); + + PyObject *xarray = detail::get_array(x); + PyObject *yarray = detail::get_array(y); + PyObject *zarray = detail::get_array(z); + + // construct positional args + PyObject *args = PyTuple_New(3); + PyTuple_SetItem(args, 0, xarray); + PyTuple_SetItem(args, 1, yarray); + PyTuple_SetItem(args, 2, zarray); + + // Build up the kw args. + PyObject *kwargs = PyDict_New(); + + for (std::map::const_iterator it = keywords.begin(); + it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } + PyObject *fig_args = PyTuple_New(1); + PyObject* fig = nullptr; + PyTuple_SetItem(fig_args, 0, PyLong_FromLong(fig_number)); + PyObject *fig_exists = + PyObject_CallObject(detail::_interpreter::get().s_python_function_fignum_exists, fig_args); + if (!PyObject_IsTrue(fig_exists)) { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + detail::_interpreter::get().s_python_empty_tuple); + } else { + fig = PyObject_CallObject(detail::_interpreter::get().s_python_function_figure, + fig_args); + } + Py_DECREF(fig_exists); + if (!fig) throw std::runtime_error("Call to figure() failed."); + + PyObject *gca_kwargs = PyDict_New(); + PyDict_SetItemString(gca_kwargs, "projection", PyString_FromString("3d")); + + PyObject *gca = PyObject_GetAttrString(fig, "gca"); + if (!gca) throw std::runtime_error("No gca"); + Py_INCREF(gca); + PyObject *axis = PyObject_Call( + gca, detail::_interpreter::get().s_python_empty_tuple, gca_kwargs); + + if (!axis) throw std::runtime_error("No axis"); + Py_INCREF(axis); + + Py_DECREF(gca); + Py_DECREF(gca_kwargs); + + PyObject *plot3 = PyObject_GetAttrString(axis, "scatter"); + if (!plot3) throw std::runtime_error("No 3D line plot"); + Py_INCREF(plot3); + PyObject *res = PyObject_Call(plot3, args, kwargs); + if (!res) throw std::runtime_error("Failed 3D line plot"); + Py_DECREF(plot3); + + Py_DECREF(axis); + Py_DECREF(args); + Py_DECREF(kwargs); + Py_DECREF(fig); + if (res) Py_DECREF(res); + return res; + +} + template bool boxplot(const std::vector>& data, const std::vector& labels = {}, @@ -1139,9 +1267,9 @@ bool contour(const std::vector& x, const std::vector& y, const std::map& keywords = {}) { assert(x.size() == y.size() && x.size() == z.size()); - PyObject* xarray = get_array(x); - PyObject* yarray = get_array(y); - PyObject* zarray = get_array(z); + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); + PyObject* zarray = detail::get_array(z); PyObject* plot_args = PyTuple_New(3); PyTuple_SetItem(plot_args, 0, xarray); @@ -2094,12 +2222,14 @@ inline void axvspan(double xmin, double xmax, double ymin = 0., double ymax = 1. // construct keyword args PyObject* kwargs = PyDict_New(); - for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) - { - if (it->first == "linewidth" || it->first == "alpha") - PyDict_SetItemString(kwargs, it->first.c_str(), PyFloat_FromDouble(std::stod(it->second))); - else - PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + if (it->first == "linewidth" || it->first == "alpha") { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyFloat_FromDouble(std::stod(it->second))); + } else { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } } PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axvspan, args, kwargs); @@ -2319,6 +2449,25 @@ inline void save(const std::string& filename) Py_DECREF(res); } +inline void rcparams(const std::map& keywords = {}) { + detail::_interpreter::get(); + PyObject* args = PyTuple_New(0); + PyObject* kwargs = PyDict_New(); + for (auto it = keywords.begin(); it != keywords.end(); ++it) { + if ("text.usetex" == it->first) + PyDict_SetItemString(kwargs, it->first.c_str(), PyLong_FromLong(std::stoi(it->second.c_str()))); + else PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + PyObject * update = PyObject_GetAttrString(detail::_interpreter::get().s_python_function_rcparams, "update"); + PyObject * res = PyObject_Call(update, args, kwargs); + if(!res) throw std::runtime_error("Call to rcParams.update() failed."); + Py_DECREF(args); + Py_DECREF(kwargs); + Py_DECREF(update); + Py_DECREF(res); +} + inline void clf() { detail::_interpreter::get(); From d1b7c72be8b9c3cb28bfc565a0975117414be3e5 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Aug 2020 19:43:50 +0300 Subject: [PATCH 70/86] Add #include for std::stod See https://en.cppreference.com/w/cpp/string/basic_string/stof for details. --- matplotlibcpp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 226a16a..b3d57f7 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -13,6 +13,7 @@ #include #include // requires c++11 support #include +#include // std::stod #ifndef WITHOUT_NUMPY # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION From 2bf4f26d727cc164e309122fb29f3fb733c087f2 Mon Sep 17 00:00:00 2001 From: William Leong Date: Fri, 2 Oct 2020 15:48:08 +0800 Subject: [PATCH 71/86] Fix #221 and #225 --- matplotlibcpp.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index b3d57f7..18d83b8 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -176,7 +176,12 @@ struct _interpreter { wchar_t const *dummy_args[] = {L"Python", NULL}; // const is needed because literals must not be modified wchar_t const **argv = dummy_args; int argc = sizeof(dummy_args)/sizeof(dummy_args[0])-1; + +#if PY_MAJOR_VERSION >= 3 PySys_SetArgv(argc, const_cast(argv)); +#else + PySys_SetArgv(argc, (char **)(argv)); +#endif #ifndef WITHOUT_NUMPY import_numpy(); // initialize numpy C-API @@ -362,7 +367,7 @@ PyObject* get_array(const std::vector& v) PyArray_UpdateFlags(reinterpret_cast(varray), NPY_ARRAY_OWNDATA); return varray; } - + PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, type, (void*)(v.data())); return varray; } @@ -429,7 +434,7 @@ PyObject* get_listlist(const std::vector>& ll) } // namespace detail /// Plot a line through the given x and y data points.. -/// +/// /// See: https://matplotlib.org/3.2.1/api/_as_gen/matplotlib.pyplot.plot.html template bool plot(const std::vector &x, const std::vector &y, const std::map& keywords) @@ -587,9 +592,9 @@ void plot3(const std::vector &x, { detail::_interpreter::get(); - // Same as with plot_surface: We lazily load the modules here the first time - // this function is called because I'm not sure that we can assume "matplotlib - // installed" implies "mpl_toolkits installed" on all platforms, and we don't + // Same as with plot_surface: We lazily load the modules here the first time + // this function is called because I'm not sure that we can assume "matplotlib + // installed" implies "mpl_toolkits installed" on all platforms, and we don't // want to require it for people who don't need 3d plots. static PyObject *mpl_toolkitsmod = nullptr, *axis3dmod = nullptr; if (!mpl_toolkitsmod) { @@ -1849,7 +1854,7 @@ inline void legend(const std::map& keywords) if(!res) throw std::runtime_error("Call to legend() failed."); Py_DECREF(kwargs); - Py_DECREF(res); + Py_DECREF(res); } template @@ -2089,7 +2094,7 @@ inline void tick_params(const std::map& keywords, cons inline void subplot(long nrows, long ncols, long plot_number) { detail::_interpreter::get(); - + // construct positional args PyObject* args = PyTuple_New(3); PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows)); @@ -2154,7 +2159,7 @@ inline void title(const std::string &titlestr, const std::map &keywords = {}) { detail::_interpreter::get(); - + PyObject* pysuptitlestr = PyString_FromString(suptitlestr.c_str()); PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pysuptitlestr); @@ -2286,9 +2291,9 @@ inline void set_zlabel(const std::string &str, const std::map Date: Fri, 27 Nov 2020 17:23:34 +0100 Subject: [PATCH 72/86] Adding possibility to choose dpi when saving --- matplotlibcpp.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 18d83b8..a7318f5 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -2439,7 +2439,7 @@ inline void pause(Numeric interval) Py_DECREF(res); } -inline void save(const std::string& filename) +inline void save(const std::string& filename, const int dpi=0) { detail::_interpreter::get(); @@ -2448,10 +2448,18 @@ inline void save(const std::string& filename) PyObject* args = PyTuple_New(1); PyTuple_SetItem(args, 0, pyfilename); - PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_save, args); + PyObject* kwargs = PyDict_New(); + + if(dpi > 0) + { + PyDict_SetItemString(kwargs, "dpi", PyLong_FromLong(dpi)); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_save, args, kwargs); if (!res) throw std::runtime_error("Call to save() failed."); Py_DECREF(args); + Py_DECREF(kwargs); Py_DECREF(res); } From 490fa9cda0b8ce39dbb900836c4fb1c0296ac7c0 Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Fri, 19 Feb 2021 14:12:14 +0000 Subject: [PATCH 73/86] Fix memory leaks in xlim() and ylim() Memory is allocated with new and delete is never called. Use a std::array instead, so no memory will be allocated. --- matplotlibcpp.h | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index a7318f5..643a120 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1896,43 +1896,33 @@ void xlim(Numeric left, Numeric right) } -inline double* xlim() +inline std::array xlim() { - detail::_interpreter::get(); - PyObject* args = PyTuple_New(0); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_xlim, args); - PyObject* left = PyTuple_GetItem(res,0); - PyObject* right = PyTuple_GetItem(res,1); - - double* arr = new double[2]; - arr[0] = PyFloat_AsDouble(left); - arr[1] = PyFloat_AsDouble(right); if(!res) throw std::runtime_error("Call to xlim() failed."); Py_DECREF(res); - return arr; + + PyObject* left = PyTuple_GetItem(res,0); + PyObject* right = PyTuple_GetItem(res,1); + return { PyFloat_AsDouble(left), PyFloat_AsDouble(right) }; } -inline double* ylim() +inline std::array ylim() { - detail::_interpreter::get(); - PyObject* args = PyTuple_New(0); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_ylim, args); - PyObject* left = PyTuple_GetItem(res,0); - PyObject* right = PyTuple_GetItem(res,1); - - double* arr = new double[2]; - arr[0] = PyFloat_AsDouble(left); - arr[1] = PyFloat_AsDouble(right); if(!res) throw std::runtime_error("Call to ylim() failed."); Py_DECREF(res); - return arr; + + PyObject* left = PyTuple_GetItem(res,0); + PyObject* right = PyTuple_GetItem(res,1); + return { PyFloat_AsDouble(left), PyFloat_AsDouble(right) }; } template From 08ff087d5ec3bfb5066335e7300e40e56b09aefb Mon Sep 17 00:00:00 2001 From: Florian Fervers Date: Wed, 10 Feb 2021 17:37:13 +0100 Subject: [PATCH 74/86] Add modern cmake support --- CMakeLists.txt | 125 ++++++++++++++++++++++++++++ cmake/matplotlib_cppConfig.cmake.in | 7 ++ 2 files changed, 132 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/matplotlib_cppConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4e1ef89 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,125 @@ +cmake_minimum_required(VERSION 3.8 FATAL_ERROR) +project(matplotlib_cpp LANGUAGES CXX) + +include(GNUInstallDirs) +set(PACKAGE_NAME matplotlib_cpp) +set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}/cmake) + + +# Library target +add_library(matplotlib_cpp INTERFACE) +target_include_directories(matplotlib_cpp + INTERFACE + $ + $ +) +target_compile_features(matplotlib_cpp INTERFACE + cxx_std_11 +) +find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +target_link_libraries(matplotlib_cpp INTERFACE + Python3::Python + Python3::Module +) +find_package(Python3 COMPONENTS NumPy) +if(Python3_NumPy_FOUND) + target_link_libraries(matplotlib_cpp INTERFACE + Python3::NumPy + ) +else() + target_compile_definitions(matplotlib_cpp INTERFACE WITHOUT_NUMPY) +endif() +install( + TARGETS matplotlib_cpp + EXPORT install_targets +) + + +# Examples +add_executable(minimal examples/minimal.cpp) +target_link_libraries(minimal PRIVATE matplotlib_cpp) +set_target_properties(minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(basic examples/basic.cpp) +target_link_libraries(basic PRIVATE matplotlib_cpp) +set_target_properties(basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(modern examples/modern.cpp) +target_link_libraries(modern PRIVATE matplotlib_cpp) +set_target_properties(modern PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(animation examples/animation.cpp) +target_link_libraries(animation PRIVATE matplotlib_cpp) +set_target_properties(animation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(nonblock examples/nonblock.cpp) +target_link_libraries(nonblock PRIVATE matplotlib_cpp) +set_target_properties(nonblock PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(xkcd examples/xkcd.cpp) +target_link_libraries(xkcd PRIVATE matplotlib_cpp) +set_target_properties(xkcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(bar examples/bar.cpp) +target_link_libraries(bar PRIVATE matplotlib_cpp) +set_target_properties(bar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(fill_inbetween examples/fill_inbetween.cpp) +target_link_libraries(fill_inbetween PRIVATE matplotlib_cpp) +set_target_properties(fill_inbetween PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(fill examples/fill.cpp) +target_link_libraries(fill PRIVATE matplotlib_cpp) +set_target_properties(fill PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(update examples/update.cpp) +target_link_libraries(update PRIVATE matplotlib_cpp) +set_target_properties(update PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(subplot2grid examples/subplot2grid.cpp) +target_link_libraries(subplot2grid PRIVATE matplotlib_cpp) +set_target_properties(subplot2grid PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(lines3d examples/lines3d.cpp) +target_link_libraries(lines3d PRIVATE matplotlib_cpp) +set_target_properties(lines3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +if(Python3_NumPy_FOUND) + add_executable(surface examples/surface.cpp) + target_link_libraries(surface PRIVATE matplotlib_cpp) + set_target_properties(surface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + add_executable(colorbar examples/colorbar.cpp) + target_link_libraries(colorbar PRIVATE matplotlib_cpp) + set_target_properties(colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() + + +# Install headers +install(FILES + "${PROJECT_SOURCE_DIR}/matplotlibcpp.h" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + +# Install targets file +install(EXPORT install_targets + FILE + ${PACKAGE_NAME}Targets.cmake + NAMESPACE + ${PACKAGE_NAME}:: + DESTINATION + ${INSTALL_CONFIGDIR} +) + + +# Install matplotlib_cppConfig.cmake +include(CMakePackageConfigHelpers) +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PACKAGE_NAME}Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake + INSTALL_DESTINATION ${INSTALL_CONFIGDIR} +) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake + DESTINATION ${INSTALL_CONFIGDIR} +) diff --git a/cmake/matplotlib_cppConfig.cmake.in b/cmake/matplotlib_cppConfig.cmake.in new file mode 100644 index 0000000..1793f29 --- /dev/null +++ b/cmake/matplotlib_cppConfig.cmake.in @@ -0,0 +1,7 @@ +get_filename_component(matplotlib_cpp_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +if(NOT TARGET matplotlib_cpp::matplotlib_cpp) + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + find_package(Python3 COMPONENTS NumPy) + include("${matplotlib_cpp_CMAKE_DIR}/matplotlib_cppTargets.cmake") +endif() From 3d3f9da65108e17c19799805786bb81e0776ea0f Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 26 Mar 2021 10:30:33 +0100 Subject: [PATCH 75/86] Unbreak examples by moving 'fig_number' paramter to the end of the list --- matplotlibcpp.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 643a120..9363b71 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -475,9 +475,9 @@ template void plot_surface(const std::vector<::std::vector> &x, const std::vector<::std::vector> &y, const std::vector<::std::vector> &z, - const long fig_number=0, const std::map &keywords = - std::map()) + std::map(), + const long fig_number=0) { detail::_interpreter::get(); @@ -586,9 +586,9 @@ template void plot3(const std::vector &x, const std::vector &y, const std::vector &z, - const long fig_number=0, const std::map &keywords = - std::map()) + std::map(), + const long fig_number=0) { detail::_interpreter::get(); @@ -953,8 +953,8 @@ bool scatter(const std::vector& x, const std::vector& y, const std::vector& z, const double s=1.0, // The marker size in points**2 - const long fig_number=0, - const std::map & keywords = {}) { + const std::map & keywords = {}, + const long fig_number=0) { detail::_interpreter::get(); // Same as with plot_surface: We lazily load the modules here the first time From cab80f33cd137dca50b98fe4ccb830d7e657721d Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 26 Mar 2021 10:40:39 +0100 Subject: [PATCH 76/86] Remove obsoleted build systems After the switch to cmake, we don't need the hand-written Makefile nor the contrib/ version of the cmake file. --- Makefile | 41 --------------------------------- README.md | 52 +++++++++++++++--------------------------- contrib/CMakeLists.txt | 26 --------------------- numpy_flags.py | 12 ---------- 4 files changed, 18 insertions(+), 113 deletions(-) delete mode 100644 Makefile delete mode 100644 contrib/CMakeLists.txt delete mode 100644 numpy_flags.py diff --git a/Makefile b/Makefile deleted file mode 100644 index 67b5ac3..0000000 --- a/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# Use C++11, dont warn on long-to-float conversion -CXXFLAGS += -std=c++11 -Wno-conversion - -# Default to using system's default version of python -PYTHON_BIN ?= python3 -PYTHON_CONFIG := $(PYTHON_BIN)-config -PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes) -EXTRA_FLAGS := $(PYTHON_INCLUDE) -# NOTE: Since python3.8, the correct invocation is `python3-config --libs --embed`. -# So of course the proper way to get python libs for embedding now is to -# invoke that, check if it crashes, and fall back to just `--libs` if it does. -LDFLAGS += $(shell if $(PYTHON_CONFIG) --ldflags --embed >/dev/null; then $(PYTHON_CONFIG) --ldflags --embed; else $(PYTHON_CONFIG) --ldflags; fi) - -# Either finds numpy or set -DWITHOUT_NUMPY -EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py) -WITHOUT_NUMPY := $(findstring $(EXTRA_FLAGS), WITHOUT_NUMPY) - -# Examples requiring numpy support to compile -EXAMPLES_NUMPY := surface colorbar -EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \ - fill_inbetween fill update subplot2grid lines3d \ - $(if $(WITHOUT_NUMPY),,$(EXAMPLES_NUMPY)) - -# Prefix every example with 'examples/build/' -EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES)) - -.PHONY: examples - -examples: $(EXAMPLE_TARGETS) - -docs: - doxygen - moxygen doc/xml --noindex -o doc/api.md - -# Assume every *.cpp file is a separate example -$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp matplotlibcpp.h - mkdir -p examples/build - $(CXX) -o $@ $< $(EXTRA_FLAGS) $(CXXFLAGS) $(LDFLAGS) - -clean: - rm -f ${EXAMPLE_TARGETS} diff --git a/README.md b/README.md index 61ffef4..0f8479f 100644 --- a/README.md +++ b/README.md @@ -202,39 +202,34 @@ If, for some reason, you're unable to get a working installation of numpy on you you can define the macro `WITHOUT_NUMPY` before including the header file to erase this dependency. -The C++-part of the library consists of the single header file `matplotlibcpp.h` which can be placed -anywhere. +The C++-part of the library consists of the single header file `matplotlibcpp.h` which +can be placed anywhere. -Since a python interpreter is opened internally, it is necessary to link against `libpython` in order -to user matplotlib-cpp. Most versions should work, although `libpython2.7` and `libpython3.6` are -probably the most regularly testedr. +Since a python interpreter is opened internally, it is necessary to link +against `libpython` in order to user matplotlib-cpp. Most versions should +work, although python likes to randomly break compatibility from time to time +so some caution is advised when using the bleeding edge. # CMake -If you prefer to use CMake as build system, you will want to add something like this to your -CMakeLists.txt: +The C++ code is compatible to both python2 and python3. However, the `CMakeLists.txt` +file is currently set up to use python3 by default, so if python2 is required this +has to be changed manually. (a PR that adds a cmake option for this would be highly +welcomed) -**Recommended way (since CMake 3.12):** +**NOTE**: By design (of python), only a single python interpreter can be created per +process. When using this library, *no other* library that is spawning a python +interpreter internally can be used. -It's easy to use cmake official [docs](https://cmake.org/cmake/help/git-stage/module/FindPython2.html#module:FindPython2) to find Python 2(or 3) interpreter, compiler and development environment (include directories and libraries). +To compile the code without using cmake, the compiler invocation should look like +this: -NumPy is optional here, delete it from cmake script, if you don't need it. + g++ example.cpp -I/usr/include/python2.7 -lpython2.7 -```cmake -find_package(Python2 COMPONENTS Development NumPy) -target_include_directories(myproject PRIVATE ${Python2_INCLUDE_DIRS} ${Python2_NumPy_INCLUDE_DIRS}) -target_link_libraries(myproject Python2::Python Python2::NumPy) -``` - -**Alternative way (for CMake <= 3.11):** - -```cmake -find_package(PythonLibs 2.7) -target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS}) -target_link_libraries(myproject ${PYTHON_LIBRARIES}) -``` +This can also be used for linking against a custom build of python + g++ example.cpp -I/usr/local/include/fancy-python4 -L/usr/local/lib -lfancy-python4 # Vcpkg @@ -258,17 +253,6 @@ Note that support for c++98 was dropped more or less accidentally, so if you hav with an ancient compiler and still want to enjoy the latest additional features, I'd probably merge a PR that restores support. -# Python 3 - -This library supports both python2 and python3 (although the python3 support is probably far less tested, -so it is recommended to prefer python2.7). To switch the used python version, simply change -the compiler flags accordingly. - - g++ example.cpp -I/usr/include/python3.6 -lpython3.6 - -The same technique can be used for linking against a custom build of python - - g++ example.cpp -I/usr/local/include/fancy-python4 -L/usr/local/lib -lfancy-python4 Why? diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt deleted file mode 100644 index edb40b1..0000000 --- a/contrib/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.7) -project (MatplotlibCPP_Test) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include_directories(${PYTHONHOME}/include) -include_directories(${PYTHONHOME}/Lib/site-packages/numpy/core/include) -link_directories(${PYTHONHOME}/libs) - -add_definitions(-DMATPLOTLIBCPP_PYTHON_HEADER=Python.h) - -# message(STATUS "*** dump start cmake variables ***") -# get_cmake_property(_variableNames VARIABLES) -# foreach(_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -# endforeach() -# message(STATUS "*** dump end ***") - -add_executable(minimal ${CMAKE_CURRENT_SOURCE_DIR}/../examples/minimal.cpp) -add_executable(basic ${CMAKE_CURRENT_SOURCE_DIR}/../examples/basic.cpp) -add_executable(modern ${CMAKE_CURRENT_SOURCE_DIR}/../examples/modern.cpp) -add_executable(animation ${CMAKE_CURRENT_SOURCE_DIR}/../examples/animation.cpp) -add_executable(nonblock ${CMAKE_CURRENT_SOURCE_DIR}/../examples/nonblock.cpp) -add_executable(xkcd ${CMAKE_CURRENT_SOURCE_DIR}/../examples/xkcd.cpp) -add_executable(bar ${CMAKE_CURRENT_SOURCE_DIR}/../examples/bar.cpp) diff --git a/numpy_flags.py b/numpy_flags.py deleted file mode 100644 index 56fd95c..0000000 --- a/numpy_flags.py +++ /dev/null @@ -1,12 +0,0 @@ -from os import path - -try: - from numpy import __file__ as numpyloc - - # Get numpy directory - numpy_dir = path.dirname(numpyloc) - - # Print the result of joining this to core and include - print("-I" + path.join(numpy_dir, "core", "include")) -except: - print("-DWITHOUT_NUMPY") From 1875696c55c1ae0ae93546f738fbf0047ffa6190 Mon Sep 17 00:00:00 2001 From: Pierre Narvor Date: Wed, 31 Mar 2021 15:16:49 +0200 Subject: [PATCH 77/86] Added 'set_aspect' and set_aspect_equal function --- examples/modern.cpp | 3 +++ matplotlibcpp.h | 56 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/examples/modern.cpp b/examples/modern.cpp index a8aa0c7..871ef2b 100644 --- a/examples/modern.cpp +++ b/examples/modern.cpp @@ -24,6 +24,9 @@ int main() // y must either be callable (providing operator() const) or iterable. plt::plot(x, y, "r-", x, [](double d) { return 12.5+abs(sin(d)); }, "k-"); + //plt::set_aspect(0.5); + plt::set_aspect_equal(); + // show plots plt::show(); diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 9363b71..a151d6f 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1857,6 +1857,62 @@ inline void legend(const std::map& keywords) Py_DECREF(res); } +template +inline void set_aspect(Numeric ratio) +{ + detail::_interpreter::get(); + + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(ratio)); + PyObject* kwargs = PyDict_New(); + + PyObject *ax = + PyObject_CallObject(detail::_interpreter::get().s_python_function_gca, + detail::_interpreter::get().s_python_empty_tuple); + if (!ax) throw std::runtime_error("Call to gca() failed."); + Py_INCREF(ax); + + PyObject *set_aspect = PyObject_GetAttrString(ax, "set_aspect"); + if (!set_aspect) throw std::runtime_error("Attribute set_aspect not found."); + Py_INCREF(set_aspect); + + PyObject *res = PyObject_Call(set_aspect, args, kwargs); + if (!res) throw std::runtime_error("Call to set_aspect() failed."); + Py_DECREF(set_aspect); + + Py_DECREF(ax); + Py_DECREF(args); + Py_DECREF(kwargs); +} + +inline void set_aspect_equal() +{ + // expect ratio == "equal". Leaving error handling to matplotlib. + detail::_interpreter::get(); + + PyObject* args = PyTuple_New(1); + PyTuple_SetItem(args, 0, PyString_FromString("equal")); + PyObject* kwargs = PyDict_New(); + + PyObject *ax = + PyObject_CallObject(detail::_interpreter::get().s_python_function_gca, + detail::_interpreter::get().s_python_empty_tuple); + if (!ax) throw std::runtime_error("Call to gca() failed."); + Py_INCREF(ax); + + PyObject *set_aspect = PyObject_GetAttrString(ax, "set_aspect"); + if (!set_aspect) throw std::runtime_error("Attribute set_aspect not found."); + Py_INCREF(set_aspect); + + PyObject *res = PyObject_Call(set_aspect, args, kwargs); + if (!res) throw std::runtime_error("Call to set_aspect() failed."); + Py_DECREF(set_aspect); + + Py_DECREF(ax); + Py_DECREF(args); + Py_DECREF(kwargs); +} + template void ylim(Numeric left, Numeric right) { From ec3745302a8295e3d7b28f910fb1a39936886a40 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Sat, 23 May 2020 17:10:42 +0200 Subject: [PATCH 78/86] add axhline --- matplotlibcpp.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index a151d6f..f6365cb 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -75,6 +75,7 @@ struct _interpreter { PyObject *s_python_function_ylim; PyObject *s_python_function_title; PyObject *s_python_function_axis; + PyObject *s_python_function_axhline; PyObject *s_python_function_axvline; PyObject *s_python_function_axvspan; PyObject *s_python_function_xlabel; @@ -247,6 +248,7 @@ struct _interpreter { s_python_function_ylim = safe_import(pymod, "ylim"); s_python_function_title = safe_import(pymod, "title"); s_python_function_axis = safe_import(pymod, "axis"); + s_python_function_axhline = safe_import(pymod, "axhline"); s_python_function_axvline = safe_import(pymod, "axvline"); s_python_function_axvspan = safe_import(pymod, "axvspan"); s_python_function_xlabel = safe_import(pymod, "xlabel"); @@ -2238,6 +2240,31 @@ inline void axis(const std::string &axisstr) Py_DECREF(res); } +inline void axhline(double y, double xmin = 0., double xmax = 1., const std::map& keywords = std::map()) +{ + detail::_interpreter::get(); + + // construct positional args + PyObject* args = PyTuple_New(3); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(y)); + PyTuple_SetItem(args, 1, PyFloat_FromDouble(xmin)); + PyTuple_SetItem(args, 2, PyFloat_FromDouble(xmax)); + + // construct keyword args + PyObject* kwargs = PyDict_New(); + for(std::map::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + { + PyDict_SetItemString(kwargs, it->first.c_str(), PyString_FromString(it->second.c_str())); + } + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_axhline, args, kwargs); + + Py_DECREF(args); + Py_DECREF(kwargs); + + if(res) Py_DECREF(res); +} + inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map& keywords = std::map()) { detail::_interpreter::get(); From bbfb240ba80e9cb890a0c4dc259552ee8b235854 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Sat, 23 May 2020 17:34:06 +0200 Subject: [PATCH 79/86] add contour plot --- examples/contour.cpp | 24 ++++++++++++++++++++ matplotlibcpp.h | 54 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 examples/contour.cpp diff --git a/examples/contour.cpp b/examples/contour.cpp new file mode 100644 index 0000000..9289d0a --- /dev/null +++ b/examples/contour.cpp @@ -0,0 +1,24 @@ +#include "../matplotlibcpp.h" + +#include + +namespace plt = matplotlibcpp; + +int main() +{ + std::vector> x, y, z; + for (double i = -5; i <= 5; i += 0.25) { + std::vector x_row, y_row, z_row; + for (double j = -5; j <= 5; j += 0.25) { + x_row.push_back(i); + y_row.push_back(j); + z_row.push_back(::std::sin(::std::hypot(i, j))); + } + x.push_back(x_row); + y.push_back(y_row); + z.push_back(z_row); + } + + plt::contour(x, y, z); + plt::show(); +} diff --git a/matplotlibcpp.h b/matplotlibcpp.h index f6365cb..abf0284 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -103,7 +103,6 @@ struct _interpreter { PyObject *s_python_function_subplots_adjust; PyObject *s_python_function_rcparams; - /* For now, _interpreter is implemented as a singleton since its currently not possible to have multiple independent embedded python interpreters without patching the python source code or starting a separate process for each. [1] @@ -245,6 +244,7 @@ struct _interpreter { s_python_function_subplot = safe_import(pymod, "subplot"); s_python_function_subplot2grid = safe_import(pymod, "subplot2grid"); s_python_function_legend = safe_import(pymod, "legend"); + s_python_function_xlim = safe_import(pymod, "xlim"); s_python_function_ylim = safe_import(pymod, "ylim"); s_python_function_title = safe_import(pymod, "title"); s_python_function_axis = safe_import(pymod, "axis"); @@ -259,7 +259,6 @@ struct _interpreter { s_python_function_margins = safe_import(pymod, "margins"); s_python_function_tick_params = safe_import(pymod, "tick_params"); s_python_function_grid = safe_import(pymod, "grid"); - s_python_function_xlim = safe_import(pymod, "xlim"); s_python_function_ion = safe_import(pymod, "ion"); s_python_function_ginput = safe_import(pymod, "ginput"); s_python_function_save = safe_import(pylabmod, "savefig"); @@ -349,10 +348,10 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY // Sanity checks; comment them out or change the numpy type below if you're compiling on // a platform where they don't apply -static_assert(sizeof(long long) == 8); -template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; -static_assert(sizeof(unsigned long long) == 8); -template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; +// static_assert(sizeof(long long) == 8); +// template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; +// static_assert(sizeof(unsigned long long) == 8); +// template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; // TODO: add int, long, etc. template @@ -582,6 +581,49 @@ void plot_surface(const std::vector<::std::vector> &x, Py_DECREF(kwargs); if (res) Py_DECREF(res); } + +template +void contour(const std::vector<::std::vector> &x, + const std::vector<::std::vector> &y, + const std::vector<::std::vector> &z, + const std::map &keywords = {}) +{ + detail::_interpreter::get(); + + // using numpy arrays + PyObject *xarray = detail::get_2darray(x); + PyObject *yarray = detail::get_2darray(y); + PyObject *zarray = detail::get_2darray(z); + + // construct positional args + PyObject *args = PyTuple_New(3); + PyTuple_SetItem(args, 0, xarray); + PyTuple_SetItem(args, 1, yarray); + PyTuple_SetItem(args, 2, zarray); + + // Build up the kw args. + PyObject *kwargs = PyDict_New(); + + PyObject *python_colormap_coolwarm = PyObject_GetAttrString( + detail::_interpreter::get().s_python_colormap, "coolwarm"); + + PyDict_SetItemString(kwargs, "cmap", python_colormap_coolwarm); + + for (std::map::const_iterator it = keywords.begin(); + it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } + + PyObject *res = PyObject_Call(detail::_interpreter::get().s_python_function_contour, args, kwargs); + if (!res) + throw std::runtime_error("failed contour"); + + Py_DECREF(args); + Py_DECREF(kwargs); + if (res) + Py_DECREF(res); +} #endif // WITHOUT_NUMPY template From 9ff7a4b29db0ef27da0136a9e6930d385b93fe50 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Sat, 23 May 2020 18:40:22 +0200 Subject: [PATCH 80/86] add spy --- examples/spy.cpp | 29 +++++++++++++++++++++++++++++ matplotlibcpp.h | 45 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 examples/spy.cpp diff --git a/examples/spy.cpp b/examples/spy.cpp new file mode 100644 index 0000000..80bd544 --- /dev/null +++ b/examples/spy.cpp @@ -0,0 +1,29 @@ +#import +#import +#import "../matplotlibcpp.h" + +namespace plt = matplotlibcpp; + +int main() +{ + const int n = 20; + std::vector> matrix; + + for (int i = 0; i < n; ++i) { + std::vector row; + for (int j = 0; j < n; ++j) { + if (i == j) + row.push_back(-2); + else if (j == i - 1 || j == i + 1) + row.push_back(1); + else + row.push_back(0); + } + matrix.push_back(row); + } + + plt::spy(matrix, 5, {{"marker", "o"}}); + plt::show(); + + return 0; +} \ No newline at end of file diff --git a/matplotlibcpp.h b/matplotlibcpp.h index abf0284..9ad7faa 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -102,6 +102,7 @@ struct _interpreter { PyObject *s_python_function_colorbar; PyObject *s_python_function_subplots_adjust; PyObject *s_python_function_rcparams; + PyObject *s_python_function_spy; /* For now, _interpreter is implemented as a singleton since its currently not possible to have multiple independent embedded python interpreters without patching the python source code @@ -276,6 +277,7 @@ struct _interpreter { s_python_function_colorbar = PyObject_GetAttrString(pymod, "colorbar"); s_python_function_subplots_adjust = safe_import(pymod,"subplots_adjust"); s_python_function_rcparams = PyObject_GetAttrString(pymod, "rcParams"); + s_python_function_spy = PyObject_GetAttrString(pymod, "spy"); #ifndef WITHOUT_NUMPY s_python_function_imshow = safe_import(pymod, "imshow"); #endif @@ -348,11 +350,11 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY // Sanity checks; comment them out or change the numpy type below if you're compiling on // a platform where they don't apply -// static_assert(sizeof(long long) == 8); -// template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; -// static_assert(sizeof(unsigned long long) == 8); -// template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; -// TODO: add int, long, etc. +static_assert(sizeof(long long) == 8); +template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; +static_assert(sizeof(unsigned long long) == 8); +template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; +TODO: add int, long, etc. template PyObject* get_array(const std::vector& v) @@ -621,8 +623,37 @@ void contour(const std::vector<::std::vector> &x, Py_DECREF(args); Py_DECREF(kwargs); - if (res) - Py_DECREF(res); + if (res) Py_DECREF(res); +} + +template +void spy(const std::vector<::std::vector> &x, + const double markersize = -1, // -1 for default matplotlib size + const std::map &keywords = {}) +{ + detail::_interpreter::get(); + + PyObject *xarray = detail::get_2darray(x); + + PyObject *kwargs = PyDict_New(); + if (markersize != -1) { + PyDict_SetItemString(kwargs, "markersize", PyFloat_FromDouble(markersize)); + } + for (std::map::const_iterator it = keywords.begin(); + it != keywords.end(); ++it) { + PyDict_SetItemString(kwargs, it->first.c_str(), + PyString_FromString(it->second.c_str())); + } + + PyObject *plot_args = PyTuple_New(1); + PyTuple_SetItem(plot_args, 0, xarray); + + PyObject *res = PyObject_Call( + detail::_interpreter::get().s_python_function_spy, plot_args, kwargs); + + Py_DECREF(plot_args); + Py_DECREF(kwargs); + if (res) Py_DECREF(res); } #endif // WITHOUT_NUMPY From 630ba843d5c92309279d9c10798be169a20b75a5 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 2 Apr 2021 21:57:56 +0200 Subject: [PATCH 81/86] Some bugfixes and adjustments for contour/spy --- CMakeLists.txt | 8 ++++++++ examples/spy.cpp | 9 +++++---- matplotlibcpp.h | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e1ef89..9353473 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories(matplotlib_cpp target_compile_features(matplotlib_cpp INTERFACE cxx_std_11 ) +# TODO: Use `Development.Embed` component when requiring cmake >= 3.18 find_package(Python3 COMPONENTS Interpreter Development REQUIRED) target_link_libraries(matplotlib_cpp INTERFACE Python3::Python @@ -92,6 +93,13 @@ if(Python3_NumPy_FOUND) add_executable(colorbar examples/colorbar.cpp) target_link_libraries(colorbar PRIVATE matplotlib_cpp) set_target_properties(colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + add_executable(contour examples/contour.cpp) + target_link_libraries(contour PRIVATE matplotlib_cpp) + set_target_properties(contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + add_executable(spy examples/spy.cpp) + target_link_libraries(spy PRIVATE matplotlib_cpp) + set_target_properties(spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") endif() diff --git a/examples/spy.cpp b/examples/spy.cpp index 80bd544..6027a48 100644 --- a/examples/spy.cpp +++ b/examples/spy.cpp @@ -1,6 +1,7 @@ -#import -#import -#import "../matplotlibcpp.h" +#include "../matplotlibcpp.h" + +#include +#include namespace plt = matplotlibcpp; @@ -26,4 +27,4 @@ int main() plt::show(); return 0; -} \ No newline at end of file +} diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 9ad7faa..e6f64e7 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -354,7 +354,6 @@ static_assert(sizeof(long long) == 8); template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; static_assert(sizeof(unsigned long long) == 8); template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; -TODO: add int, long, etc. template PyObject* get_array(const std::vector& v) From 5b88e8b98f630f305e4ea09bb975cb9a9c0cd513 Mon Sep 17 00:00:00 2001 From: Benno Evers Date: Fri, 2 Apr 2021 22:07:08 +0200 Subject: [PATCH 82/86] Change line endings in CMakeLists.txt --- CMakeLists.txt | 266 ++++++++++++++++++++++++------------------------- 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9353473..bb2decd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,133 +1,133 @@ -cmake_minimum_required(VERSION 3.8 FATAL_ERROR) -project(matplotlib_cpp LANGUAGES CXX) - -include(GNUInstallDirs) -set(PACKAGE_NAME matplotlib_cpp) -set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}/cmake) - - -# Library target -add_library(matplotlib_cpp INTERFACE) -target_include_directories(matplotlib_cpp - INTERFACE - $ - $ -) -target_compile_features(matplotlib_cpp INTERFACE - cxx_std_11 -) -# TODO: Use `Development.Embed` component when requiring cmake >= 3.18 -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -target_link_libraries(matplotlib_cpp INTERFACE - Python3::Python - Python3::Module -) -find_package(Python3 COMPONENTS NumPy) -if(Python3_NumPy_FOUND) - target_link_libraries(matplotlib_cpp INTERFACE - Python3::NumPy - ) -else() - target_compile_definitions(matplotlib_cpp INTERFACE WITHOUT_NUMPY) -endif() -install( - TARGETS matplotlib_cpp - EXPORT install_targets -) - - -# Examples -add_executable(minimal examples/minimal.cpp) -target_link_libraries(minimal PRIVATE matplotlib_cpp) -set_target_properties(minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(basic examples/basic.cpp) -target_link_libraries(basic PRIVATE matplotlib_cpp) -set_target_properties(basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(modern examples/modern.cpp) -target_link_libraries(modern PRIVATE matplotlib_cpp) -set_target_properties(modern PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(animation examples/animation.cpp) -target_link_libraries(animation PRIVATE matplotlib_cpp) -set_target_properties(animation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(nonblock examples/nonblock.cpp) -target_link_libraries(nonblock PRIVATE matplotlib_cpp) -set_target_properties(nonblock PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(xkcd examples/xkcd.cpp) -target_link_libraries(xkcd PRIVATE matplotlib_cpp) -set_target_properties(xkcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(bar examples/bar.cpp) -target_link_libraries(bar PRIVATE matplotlib_cpp) -set_target_properties(bar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(fill_inbetween examples/fill_inbetween.cpp) -target_link_libraries(fill_inbetween PRIVATE matplotlib_cpp) -set_target_properties(fill_inbetween PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(fill examples/fill.cpp) -target_link_libraries(fill PRIVATE matplotlib_cpp) -set_target_properties(fill PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(update examples/update.cpp) -target_link_libraries(update PRIVATE matplotlib_cpp) -set_target_properties(update PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(subplot2grid examples/subplot2grid.cpp) -target_link_libraries(subplot2grid PRIVATE matplotlib_cpp) -set_target_properties(subplot2grid PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -add_executable(lines3d examples/lines3d.cpp) -target_link_libraries(lines3d PRIVATE matplotlib_cpp) -set_target_properties(lines3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -if(Python3_NumPy_FOUND) - add_executable(surface examples/surface.cpp) - target_link_libraries(surface PRIVATE matplotlib_cpp) - set_target_properties(surface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - - add_executable(colorbar examples/colorbar.cpp) - target_link_libraries(colorbar PRIVATE matplotlib_cpp) - set_target_properties(colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - add_executable(contour examples/contour.cpp) - target_link_libraries(contour PRIVATE matplotlib_cpp) - set_target_properties(contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - - add_executable(spy examples/spy.cpp) - target_link_libraries(spy PRIVATE matplotlib_cpp) - set_target_properties(spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -endif() - - -# Install headers -install(FILES - "${PROJECT_SOURCE_DIR}/matplotlibcpp.h" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - - -# Install targets file -install(EXPORT install_targets - FILE - ${PACKAGE_NAME}Targets.cmake - NAMESPACE - ${PACKAGE_NAME}:: - DESTINATION - ${INSTALL_CONFIGDIR} -) - - -# Install matplotlib_cppConfig.cmake -include(CMakePackageConfigHelpers) -configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PACKAGE_NAME}Config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake - INSTALL_DESTINATION ${INSTALL_CONFIGDIR} -) -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake - DESTINATION ${INSTALL_CONFIGDIR} -) +cmake_minimum_required(VERSION 3.8 FATAL_ERROR) +project(matplotlib_cpp LANGUAGES CXX) + +include(GNUInstallDirs) +set(PACKAGE_NAME matplotlib_cpp) +set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}/cmake) + + +# Library target +add_library(matplotlib_cpp INTERFACE) +target_include_directories(matplotlib_cpp + INTERFACE + $ + $ +) +target_compile_features(matplotlib_cpp INTERFACE + cxx_std_11 +) +# TODO: Use `Development.Embed` component when requiring cmake >= 3.18 +find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +target_link_libraries(matplotlib_cpp INTERFACE + Python3::Python + Python3::Module +) +find_package(Python3 COMPONENTS NumPy) +if(Python3_NumPy_FOUND) + target_link_libraries(matplotlib_cpp INTERFACE + Python3::NumPy + ) +else() + target_compile_definitions(matplotlib_cpp INTERFACE WITHOUT_NUMPY) +endif() +install( + TARGETS matplotlib_cpp + EXPORT install_targets +) + + +# Examples +add_executable(minimal examples/minimal.cpp) +target_link_libraries(minimal PRIVATE matplotlib_cpp) +set_target_properties(minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(basic examples/basic.cpp) +target_link_libraries(basic PRIVATE matplotlib_cpp) +set_target_properties(basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(modern examples/modern.cpp) +target_link_libraries(modern PRIVATE matplotlib_cpp) +set_target_properties(modern PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(animation examples/animation.cpp) +target_link_libraries(animation PRIVATE matplotlib_cpp) +set_target_properties(animation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(nonblock examples/nonblock.cpp) +target_link_libraries(nonblock PRIVATE matplotlib_cpp) +set_target_properties(nonblock PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(xkcd examples/xkcd.cpp) +target_link_libraries(xkcd PRIVATE matplotlib_cpp) +set_target_properties(xkcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(bar examples/bar.cpp) +target_link_libraries(bar PRIVATE matplotlib_cpp) +set_target_properties(bar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(fill_inbetween examples/fill_inbetween.cpp) +target_link_libraries(fill_inbetween PRIVATE matplotlib_cpp) +set_target_properties(fill_inbetween PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(fill examples/fill.cpp) +target_link_libraries(fill PRIVATE matplotlib_cpp) +set_target_properties(fill PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(update examples/update.cpp) +target_link_libraries(update PRIVATE matplotlib_cpp) +set_target_properties(update PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(subplot2grid examples/subplot2grid.cpp) +target_link_libraries(subplot2grid PRIVATE matplotlib_cpp) +set_target_properties(subplot2grid PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +add_executable(lines3d examples/lines3d.cpp) +target_link_libraries(lines3d PRIVATE matplotlib_cpp) +set_target_properties(lines3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +if(Python3_NumPy_FOUND) + add_executable(surface examples/surface.cpp) + target_link_libraries(surface PRIVATE matplotlib_cpp) + set_target_properties(surface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + add_executable(colorbar examples/colorbar.cpp) + target_link_libraries(colorbar PRIVATE matplotlib_cpp) + set_target_properties(colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + add_executable(contour examples/contour.cpp) + target_link_libraries(contour PRIVATE matplotlib_cpp) + set_target_properties(contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + add_executable(spy examples/spy.cpp) + target_link_libraries(spy PRIVATE matplotlib_cpp) + set_target_properties(spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() + + +# Install headers +install(FILES + "${PROJECT_SOURCE_DIR}/matplotlibcpp.h" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + +# Install targets file +install(EXPORT install_targets + FILE + ${PACKAGE_NAME}Targets.cmake + NAMESPACE + ${PACKAGE_NAME}:: + DESTINATION + ${INSTALL_CONFIGDIR} +) + + +# Install matplotlib_cppConfig.cmake +include(CMakePackageConfigHelpers) +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PACKAGE_NAME}Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake + INSTALL_DESTINATION ${INSTALL_CONFIGDIR} +) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake + DESTINATION ${INSTALL_CONFIGDIR} +) From 14807809928ffec468b41a2ebe720d5187e3deb7 Mon Sep 17 00:00:00 2001 From: SpiritSeeker Date: Fri, 18 Sep 2020 17:22:46 +0530 Subject: [PATCH 83/86] Updated named plots to infer different datatypes in case of x and y inputs. --- matplotlibcpp.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index e6f64e7..fcd7c8a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1661,8 +1661,8 @@ bool named_plot(const std::string& name, const std::vector& y, const st return res; } -template -bool named_plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") +template +bool named_plot(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { detail::_interpreter::get(); @@ -1688,8 +1688,8 @@ bool named_plot(const std::string& name, const std::vector& x, const st return res; } -template -bool named_semilogx(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") +template +bool named_semilogx(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { detail::_interpreter::get(); @@ -1715,8 +1715,8 @@ bool named_semilogx(const std::string& name, const std::vector& x, cons return res; } -template -bool named_semilogy(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") +template +bool named_semilogy(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { detail::_interpreter::get(); @@ -1742,8 +1742,8 @@ bool named_semilogy(const std::string& name, const std::vector& x, cons return res; } -template -bool named_loglog(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") +template +bool named_loglog(const std::string& name, const std::vector& x, const std::vector& y, const std::string& format = "") { detail::_interpreter::get(); From 61501081ea32549df1a02dca26cb4edbe0b6a890 Mon Sep 17 00:00:00 2001 From: kesha787898 <45235408+kesha787898@users.noreply.github.com> Date: Sun, 28 Feb 2021 00:00:30 +0600 Subject: [PATCH 84/86] added scatter with colors --- matplotlibcpp.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index fcd7c8a..d95d46a 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1022,6 +1022,44 @@ bool scatter(const std::vector& x, return res; } +template + bool scatter_colored(const std::vector& x, + const std::vector& y, + const std::vector& colors, + const double s=1.0, // The marker size in points**2 + const std::map & keywords = {}) + { + detail::_interpreter::get(); + + assert(x.size() == y.size()); + + PyObject* xarray = detail::get_array(x); + PyObject* yarray = detail::get_array(y); + PyObject* colors_array = detail::get_array(colors); + + PyObject* kwargs = PyDict_New(); + PyDict_SetItemString(kwargs, "s", PyLong_FromLong(s)); + PyDict_SetItemString(kwargs, "c", colors_array); + + for (const auto& it : keywords) + { + PyDict_SetItemString(kwargs, it.first.c_str(), PyString_FromString(it.second.c_str())); + } + + PyObject* plot_args = PyTuple_New(2); + PyTuple_SetItem(plot_args, 0, xarray); + PyTuple_SetItem(plot_args, 1, yarray); + + PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_scatter, plot_args, kwargs); + + Py_DECREF(plot_args); + Py_DECREF(kwargs); + if(res) Py_DECREF(res); + + return res; + } + + template bool scatter(const std::vector& x, const std::vector& y, From 3dda5267e5f76f86a7888221df6151f2f09c93c6 Mon Sep 17 00:00:00 2001 From: Kenta Yonekura Date: Tue, 13 Apr 2021 11:20:27 +0900 Subject: [PATCH 85/86] Fix a missing M_PI in windows environment --- examples/lines3d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lines3d.cpp b/examples/lines3d.cpp index f3c201c..fd4610d 100644 --- a/examples/lines3d.cpp +++ b/examples/lines3d.cpp @@ -1,5 +1,5 @@ +#define _USE_MATH_DEFINES #include "../matplotlibcpp.h" - #include namespace plt = matplotlibcpp; From ef0383f1315d32e0156335e10b82e90b334f6d9f Mon Sep 17 00:00:00 2001 From: Kenta Yonekura Date: Tue, 13 Apr 2021 14:36:10 +0900 Subject: [PATCH 86/86] Enable cmake include definition --- cmake/matplotlib_cppConfig.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/matplotlib_cppConfig.cmake.in b/cmake/matplotlib_cppConfig.cmake.in index 1793f29..86d25d0 100644 --- a/cmake/matplotlib_cppConfig.cmake.in +++ b/cmake/matplotlib_cppConfig.cmake.in @@ -4,4 +4,7 @@ if(NOT TARGET matplotlib_cpp::matplotlib_cpp) find_package(Python3 COMPONENTS Interpreter Development REQUIRED) find_package(Python3 COMPONENTS NumPy) include("${matplotlib_cpp_CMAKE_DIR}/matplotlib_cppTargets.cmake") + + get_target_property(matplotlib_cpp_INCLUDE_DIRS matplotlib_cpp::matplotlib_cpp INTERFACE_INCLUDE_DIRECTORIES) + endif()