Skip to content

Commit 235d114

Browse files
committed
Backport "Fix: subplot()'s arguments should be ints, not doubles lava#290" PR changes.
1 parent 2c55ba0 commit 235d114

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

matplotlibcpp.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,9 +2255,13 @@ inline void subplot(long nrows, long ncols, long plot_number)
22552255

22562256
// construct positional args
22572257
PyObject* args = PyTuple_New(3);
2258-
PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows));
2259-
PyTuple_SetItem(args, 1, PyFloat_FromDouble(ncols));
2260-
PyTuple_SetItem(args, 2, PyFloat_FromDouble(plot_number));
2258+
// PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows));
2259+
// PyTuple_SetItem(args, 1, PyFloat_FromDouble(ncols));
2260+
// PyTuple_SetItem(args, 2, PyFloat_FromDouble(plot_number));
2261+
// https://github.com/lava/matplotlib-cpp/pull/290/files
2262+
PyTuple_SetItem(args, 0, PyLong_FromLong(nrows));
2263+
PyTuple_SetItem(args, 1, PyLong_FromLong(ncols));
2264+
PyTuple_SetItem(args, 2, PyLong_FromLong(plot_number));
22612265

22622266
PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_subplot, args);
22632267
if(!res) throw std::runtime_error("Call to subplot() failed.");

0 commit comments

Comments
 (0)