From 994433bd6a2b5f1f541f4dd8651f115b39677285 Mon Sep 17 00:00:00 2001 From: Nate Ruben Date: Wed, 10 May 2023 00:00:58 -0600 Subject: [PATCH 1/3] Update matplotlibcpp.h Fix subplot issue --- matplotlibcpp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index d95d46ad..387873a3 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1836,9 +1836,9 @@ 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)); - PyTuple_SetItem(args, 2, PyString_FromString(s.c_str())); + PyTuple_SetItem(args, 0, PyLong_FromDouble(nrows)); + PyTuple_SetItem(args, 1, PyLong_FromDouble(ncols)); + PyTuple_SetItem(args, 2, PyLong_FromDouble(plot_number)); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_text, args); if(!res) throw std::runtime_error("Call to text() failed."); From 3a74933b2e9bb61263e16f47ab173c8f17c9a8c4 Mon Sep 17 00:00:00 2001 From: Nate Ruben Date: Wed, 10 May 2023 00:06:15 -0600 Subject: [PATCH 2/3] Update matplotlibcpp.h again --- matplotlibcpp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 387873a3..79331bdc 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1836,9 +1836,9 @@ void text(Numeric x, Numeric y, const std::string& s = "") detail::_interpreter::get(); PyObject* args = PyTuple_New(3); - PyTuple_SetItem(args, 0, PyLong_FromDouble(nrows)); - PyTuple_SetItem(args, 1, PyLong_FromDouble(ncols)); - PyTuple_SetItem(args, 2, PyLong_FromDouble(plot_number)); + PyTuple_SetItem(args, 0, PyLong_FromDouble(x)); + PyTuple_SetItem(args, 1, PyLong_FromDouble(y)); + PyTuple_SetItem(args, 2, PyLong_FromDouble(s)); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_text, args); if(!res) throw std::runtime_error("Call to text() failed."); From 036cc4a82cf8e4b6629ce53a9f57e693a3b742b5 Mon Sep 17 00:00:00 2001 From: Nate Ruben Date: Wed, 10 May 2023 01:25:18 -0600 Subject: [PATCH 3/3] Update matplotlibcpp.h last time --- matplotlibcpp.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/matplotlibcpp.h b/matplotlibcpp.h index 79331bdc..8acf8164 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -1836,9 +1836,9 @@ void text(Numeric x, Numeric y, const std::string& s = "") detail::_interpreter::get(); PyObject* args = PyTuple_New(3); - PyTuple_SetItem(args, 0, PyLong_FromDouble(x)); - PyTuple_SetItem(args, 1, PyLong_FromDouble(y)); - PyTuple_SetItem(args, 2, PyLong_FromDouble(s)); + PyTuple_SetItem(args, 0, PyFloat_FromDouble(x)); + PyTuple_SetItem(args, 1, PyFloat_FromDouble(y)); + PyTuple_SetItem(args, 2, PyString_FromString(s.c_str())); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_text, args); if(!res) throw std::runtime_error("Call to text() failed."); @@ -2255,9 +2255,9 @@ inline void subplot(long nrows, long ncols, long plot_number) // construct positional args PyObject* args = PyTuple_New(3); - PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows)); - PyTuple_SetItem(args, 1, PyFloat_FromDouble(ncols)); - PyTuple_SetItem(args, 2, PyFloat_FromDouble(plot_number)); + PyTuple_SetItem(args, 0, PyLong_FromDouble(nrows)); + PyTuple_SetItem(args, 1, PyLong_FromDouble(ncols)); + PyTuple_SetItem(args, 2, PyLong_FromDouble(plot_number)); PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_subplot, args); if(!res) throw std::runtime_error("Call to subplot() failed.");