@@ -70,6 +70,7 @@ struct _interpreter {
70
70
PyObject *s_python_function_ylim;
71
71
PyObject *s_python_function_title;
72
72
PyObject *s_python_function_axis;
73
+ PyObject *s_python_function_axvline;
73
74
PyObject *s_python_function_xlabel;
74
75
PyObject *s_python_function_ylabel;
75
76
PyObject *s_python_function_xticks;
@@ -202,6 +203,7 @@ struct _interpreter {
202
203
s_python_function_ylim = safe_import (pymod, " ylim" );
203
204
s_python_function_title = safe_import (pymod, " title" );
204
205
s_python_function_axis = safe_import (pymod, " axis" );
206
+ s_python_function_axvline = safe_import (pymod, " axvline" );
205
207
s_python_function_xlabel = safe_import (pymod, " xlabel" );
206
208
s_python_function_ylabel = safe_import (pymod, " ylabel" );
207
209
s_python_function_xticks = safe_import (pymod, " xticks" );
@@ -1411,21 +1413,21 @@ inline void tick_params(const std::map<std::string, std::string>& keywords, cons
1411
1413
PyObject* args;
1412
1414
args = PyTuple_New (1 );
1413
1415
PyTuple_SetItem (args, 0 , PyString_FromString (axis.c_str ()));
1414
-
1416
+
1415
1417
// construct keyword args
1416
1418
PyObject* kwargs = PyDict_New ();
1417
1419
for (std::map<std::string, std::string>::const_iterator it = keywords.begin (); it != keywords.end (); ++it)
1418
1420
{
1419
1421
PyDict_SetItemString (kwargs, it->first .c_str (), PyString_FromString (it->second .c_str ()));
1420
1422
}
1421
-
1422
-
1423
+
1424
+
1423
1425
PyObject* res = PyObject_Call (detail::_interpreter::get ().s_python_function_tick_params , args, kwargs);
1424
-
1426
+
1425
1427
Py_DECREF (args);
1426
1428
Py_DECREF (kwargs);
1427
1429
if (!res) throw std::runtime_error (" Call to tick_params() failed" );
1428
-
1430
+
1429
1431
Py_DECREF (res);
1430
1432
}
1431
1433
@@ -1520,6 +1522,29 @@ inline void axis(const std::string &axisstr)
1520
1522
Py_DECREF (res);
1521
1523
}
1522
1524
1525
+ void axvline (double x, double ymin = 0 ., double ymax = 1 ., const std::map<std::string, std::string>& keywords = std::map<std::string, std::string>())
1526
+ {
1527
+ // construct positional args
1528
+ PyObject* args = PyTuple_New (3 );
1529
+ PyTuple_SetItem (args, 0 , PyFloat_FromDouble (x));
1530
+ PyTuple_SetItem (args, 1 , PyFloat_FromDouble (ymin));
1531
+ PyTuple_SetItem (args, 2 , PyFloat_FromDouble (ymax));
1532
+
1533
+ // construct keyword args
1534
+ PyObject* kwargs = PyDict_New ();
1535
+ for (std::map<std::string, std::string>::const_iterator it = keywords.begin (); it != keywords.end (); ++it)
1536
+ {
1537
+ PyDict_SetItemString (kwargs, it->first .c_str (), PyString_FromString (it->second .c_str ()));
1538
+ }
1539
+
1540
+ PyObject* res = PyObject_Call (detail::_interpreter::get ().s_python_function_axvline , args, kwargs);
1541
+
1542
+ Py_DECREF (args);
1543
+ Py_DECREF (kwargs);
1544
+
1545
+ if (res) Py_DECREF (res);
1546
+ }
1547
+
1523
1548
inline void xlabel (const std::string &str, const std::map<std::string, std::string> &keywords = {})
1524
1549
{
1525
1550
PyObject* pystr = PyString_FromString (str.c_str ());
0 commit comments