Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5ffc6c

Browse files
acxzlava
authored andcommitted
ensure interpreter is initialized for suptitle & subplot
1 parent 2843ebb commit e5ffc6c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

matplotlibcpp.h

+6
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,9 @@ inline void tick_params(const std::map<std::string, std::string>& keywords, cons
16111611

16121612
inline void subplot(long nrows, long ncols, long plot_number)
16131613
{
1614+
// Make sure interpreter is initialized
1615+
detail::_interpreter::get();
1616+
16141617
// construct positional args
16151618
PyObject* args = PyTuple_New(3);
16161619
PyTuple_SetItem(args, 0, PyFloat_FromDouble(nrows));
@@ -1670,6 +1673,9 @@ inline void title(const std::string &titlestr, const std::map<std::string, std::
16701673

16711674
inline void suptitle(const std::string &suptitlestr, const std::map<std::string, std::string> &keywords = {})
16721675
{
1676+
// Make sure interpreter is initialized
1677+
detail::_interpreter::get();
1678+
16731679
PyObject* pysuptitlestr = PyString_FromString(suptitlestr.c_str());
16741680
PyObject* args = PyTuple_New(1);
16751681
PyTuple_SetItem(args, 0, pysuptitlestr);

0 commit comments

Comments
 (0)