Skip to content

Commit 3684e93

Browse files
committed
fix merge conflict
2 parents 0805e32 + 0e32084 commit 3684e93

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

matplotlibcpp.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,16 +424,8 @@ PyObject *get_2darray(const std::vector<::std::vector<Numeric>> &v) {
424424

425425
#else // fallback if we don't have numpy: copy every element of the given vector
426426

427-
// TODO to Vector templat
428-
template <typename Numeric> PyObject *get_array(const std::vector<Numeric> &v) {
429-
PyObject *list = PyList_New(v.size());
430-
for (size_t i = 0; i < v.size(); ++i) {
431-
PyList_SetItem(list, i, PyFloat_FromDouble(v.at(i)));
432-
}
433-
return list;
434-
}
435-
436427
template <typename Vector> PyObject *get_array(const Vector &v) {
428+
detail::_interpreter::get();
437429
PyObject *list = PyList_New(v.size());
438430
for (size_t i = 0; i < v.size(); ++i) {
439431
PyList_SetItem(list, i, PyFloat_FromDouble(v.at(i)));
@@ -1203,6 +1195,8 @@ bool stem(const std::vector<Numeric> &y, const std::string &format = "") {
12031195

12041196
template <typename Numeric>
12051197
void text(Numeric x, Numeric y, const std::string &s = "") {
1198+
detail::_interpreter::get();
1199+
12061200
PyObject *args = PyTuple_New(3);
12071201
PyTuple_SetItem(args, 0, PyFloat_FromDouble(x));
12081202
PyTuple_SetItem(args, 1, PyFloat_FromDouble(y));
@@ -1475,6 +1469,8 @@ inline void yticks(const std::vector<Numeric> &ticks,
14751469
}
14761470

14771471
inline void subplot(long nrows, long ncols, long plot_number) {
1472+
detail::_interpreter::get();
1473+
14781474
// construct positional args
14791475
PyObject *args = PyTuple_New(3);
14801476
PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows));
@@ -1514,6 +1510,8 @@ inline void title(const std::string &titlestr,
15141510

15151511
inline void suptitle(const std::string &suptitlestr,
15161512
const std::map<std::string, std::string> &keywords = {}) {
1513+
detail::_interpreter::get();
1514+
15171515
PyObject *pysuptitlestr = PyString_FromString(suptitlestr.c_str());
15181516
PyObject *args = PyTuple_New(1);
15191517
PyTuple_SetItem(args, 0, pysuptitlestr);
@@ -1813,6 +1811,8 @@ template <> struct plot_impl<std::false_type> {
18131811
template <typename IterableX, typename IterableY>
18141812
bool operator()(const IterableX &x, const IterableY &y,
18151813
const std::string &format) {
1814+
detail::_interpreter::get();
1815+
18161816
// 2-phase lookup for distance, begin, end
18171817
using std::begin;
18181818
using std::distance;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy