Skip to content

Commit 4181748

Browse files
patrikforslava
authored andcommitted
Added wrapper for ion function
1 parent fb4cdf9 commit 4181748

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

matplotlibcpp.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace matplotlibcpp {
4444
PyObject *s_python_function_subplot;
4545
PyObject *s_python_function_legend;
4646
PyObject *s_python_function_xlim;
47+
PyObject *s_python_function_ion;
4748
PyObject *s_python_function_ylim;
4849
PyObject *s_python_function_title;
4950
PyObject *s_python_function_axis;
@@ -130,6 +131,7 @@ namespace matplotlibcpp {
130131
s_python_function_ylabel = PyObject_GetAttrString(pymod, "ylabel");
131132
s_python_function_grid = PyObject_GetAttrString(pymod, "grid");
132133
s_python_function_xlim = PyObject_GetAttrString(pymod, "xlim");
134+
s_python_function_ion = PyObject_GetAttrString(pymod, "ion");
133135
s_python_function_save = PyObject_GetAttrString(pylabmod, "savefig");
134136
s_python_function_annotate = PyObject_GetAttrString(pymod,"annotate");
135137
s_python_function_clf = PyObject_GetAttrString(pymod, "clf");
@@ -156,6 +158,7 @@ namespace matplotlibcpp {
156158
|| !s_python_function_ylabel
157159
|| !s_python_function_grid
158160
|| !s_python_function_xlim
161+
|| !s_python_function_ion
159162
|| !s_python_function_save
160163
|| !s_python_function_clf
161164
|| !s_python_function_annotate
@@ -185,6 +188,7 @@ namespace matplotlibcpp {
185188
|| !PyFunction_Check(s_python_function_ylabel)
186189
|| !PyFunction_Check(s_python_function_grid)
187190
|| !PyFunction_Check(s_python_function_xlim)
191+
|| !PyFunction_Check(s_python_function_ion)
188192
|| !PyFunction_Check(s_python_function_save)
189193
|| !PyFunction_Check(s_python_function_clf)
190194
|| !PyFunction_Check(s_python_function_tight_layout)
@@ -961,6 +965,16 @@ namespace matplotlibcpp {
961965
Py_DECREF(res);
962966
}
963967

968+
inline void ion() {
969+
PyObject *res = PyObject_CallObject(
970+
detail::_interpreter::get().s_python_function_ion,
971+
detail::_interpreter::get().s_python_empty_tuple);
972+
973+
if (!res) throw std::runtime_error("Call to ion() failed.");
974+
975+
Py_DECREF(res);
976+
}
977+
964978
// Actually, is there any reason not to call this automatically for every plot?
965979
inline void tight_layout() {
966980
PyObject *res = PyObject_CallObject(

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