From f1af639c4271616d0ae35ae234f4511577c53f30 Mon Sep 17 00:00:00 2001 From: Trevor Keller Date: Sun, 12 May 2019 02:08:12 -0400 Subject: [PATCH 01/56] 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 02/56] 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 03/56] 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 04/56] 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 05/56] 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 06/56] 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 07/56] 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!9ADH z_q^}1kG+4wcOTpaEU$H4=XuUK#~fqK75+e75f_^r8-YOJ-dB>-LLg8B5D1hdOmz5; z;PBjc_zlfN_P!1#{P!HwCJg?L<*H=pfk51}ME;LbAeH|RzA5428a7 zZ0YIhtiKfg};D;Ga=fcquE;f2s+En1w%_aEL% zjs317l7&J3CO+@JUu`hcLw{*nI?jYNa%-n+3+2}LbB4d{kq>;Ct2;dn{ZseFhvcDx z$GYQ(CuZv#O5_9m>-;_n9*c+KLl;j30%0r z{NKy{-?jVy9F!xKCKNayR!`_LQAMKf36PuqEWr=Hk*WOg%3p=!*y*YH1w=^-Ir zC@&u$YV%_Am@!>gutABQj=p}og8tGM-5^>_%+U6vq$Ftpa(NXMoKHp{eIrBYkq2DPD7f8nUp(gb@23VO6S)g`G98u` z1{OSI-zFzRT}5tGO*f7if4!?jKnO3649vbG$91o4=sYXu-v8@i!o*j4;uvZ#Pi7OJ zQgjg9`%iehyBif1<@hGb{>c()+^gMptVJucKGJN=?@zLaRG&hdxUMNQ? zRf2s~a-pcTz=0Lqq!4Z+nW@L4dsRd@U9EV^wCtg%_u$o?c$dHM7q5 zY;Bpgy~Vuu7NR~c`We^wSz9xFx!iGCU3j(^GViQ-@7^`DXFGzbs;W!y>Y#b&?zMqb zx3&J;(>v-J;^9FUH`}Z#GQWJGHvc`6xO8~l(LDxhRpxhG1P@@Pl98hrlU-X&)_gwT z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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 08/56] 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 09/56] 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 10/56] 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 11/56] 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 12/56] 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 13/56] :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 14/56] :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 15/56] :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 16/56] :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 17/56] :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 18/56] 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 19/56] 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 20/56] 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 21/56] 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 22/56] 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 23/56] 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 24/56] 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 25/56] 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 26/56] 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 27/56] 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 28/56] 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 29/56] 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 30/56] 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 31/56] 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 32/56] 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 33/56] 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 34/56] 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 35/56] 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 36/56] 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 37/56] 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 38/56] 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 39/56] 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 40/56] 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 41/56] 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 42/56] 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 43/56] 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 44/56] 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 45/56] 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 46/56] 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 47/56] 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 48/56] 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 49/56] 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 50/56] 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 51/56] 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 52/56] 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 53/56] 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 54/56] 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 55/56] 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 56/56] 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()