File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,38 @@ namespace matplotlibcpp {
354354 Py_DECREF (args);
355355 Py_DECREF (res);
356356 }
357+
358+
359+ double * xlim ()
360+ {
361+ PyObject* args = PyTuple_New (0 );
362+ PyObject* res = PyObject_CallObject (detail::_interpreter::get ().s_python_function_xlim , args);
363+ PyObject * left = PyTuple_GetItem (res,0 );
364+ PyObject * right = PyTuple_GetItem (res,1 );
365+ double * arr = new double [2 ];
366+ arr[0 ] = PyFloat_AsDouble (left);
367+ arr[1 ] = PyFloat_AsDouble (right);
368+
369+ if (!res) throw std::runtime_error (" Call to xlim() failed." );
370+ Py_DECREF (res);
371+ return arr;
372+ }
373+
374+
375+ double * ylim ()
376+ {
377+ PyObject* args = PyTuple_New (0 );
378+ PyObject* res = PyObject_CallObject (detail::_interpreter::get ().s_python_function_ylim , args);
379+ PyObject * left = PyTuple_GetItem (res,0 );
380+ PyObject * right = PyTuple_GetItem (res,1 );
381+ double * arr = new double [2 ];
382+ arr[0 ] = PyFloat_AsDouble (left);
383+ arr[1 ] = PyFloat_AsDouble (right);
384+
385+ if (!res) throw std::runtime_error (" Call to ylim() failed." );
386+ Py_DECREF (res);
387+ return arr;
388+ }
357389
358390 inline void subplot (long nrows, long ncols, long plot_number) {
359391 // construct positional args
You can’t perform that action at this time.
0 commit comments