Skip to content
Snippets Groups Projects
Commit e79a2869 authored by Iwainsky, Christian's avatar Iwainsky, Christian
Browse files

added close function to close figures

parent a6e3790a
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,9 @@ public: ...@@ -26,6 +26,9 @@ public:
Figure(pybind11::object &&figure) { Figure(pybind11::object &&figure) {
self = std::move(figure); self = std::move(figure);
load_attrs(); load_attrs();
}
~Figure(){
} }
// add_axes // add_axes
axes::Axes add_axes(const pybind11::tuple &args = pybind11::tuple(), axes::Axes add_axes(const pybind11::tuple &args = pybind11::tuple(),
...@@ -68,7 +71,7 @@ public: ...@@ -68,7 +71,7 @@ public:
private: private:
void load_attrs() { void load_attrs() {
LOAD_FUNC_ATTR(close, self); //LOAD_FUNC_ATTR(close, self);
LOAD_FUNC_ATTR(add_axes, self); LOAD_FUNC_ATTR(add_axes, self);
LOAD_FUNC_ATTR(add_gridspec, self); LOAD_FUNC_ATTR(add_gridspec, self);
LOAD_FUNC_ATTR(add_subplot, self); LOAD_FUNC_ATTR(add_subplot, self);
...@@ -80,7 +83,7 @@ private: ...@@ -80,7 +83,7 @@ private:
LOAD_FUNC_ATTR(set_size_inches,self); LOAD_FUNC_ATTR(set_size_inches,self);
} }
pybind11::object close_attr; //pybind11::object close_attr;
pybind11::object add_axes_attr; pybind11::object add_axes_attr;
pybind11::object add_gridspec_attr; pybind11::object add_gridspec_attr;
pybind11::object add_subplot_attr; pybind11::object add_subplot_attr;
...@@ -113,7 +116,9 @@ gridspec::GridSpec Figure::add_gridspec(int nrow, int ncol, ...@@ -113,7 +116,9 @@ gridspec::GridSpec Figure::add_gridspec(int nrow, int ncol,
// close // close
void Figure::close() { void Figure::close() {
close_attr(); self.attr("close")();
//pybind11::close(self);
//close_attr();
// pybind11::object obj = add_subplot_attr(*args, **kwargs); // pybind11::object obj = add_subplot_attr(*args, **kwargs);
//axes::close(); //axes::close();
//self.close(); //self.close();
......
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
mod = mod_; mod = mod_;
load_attrs(); load_attrs();
} }
void close(BaseWrapper & obj);
// axes // axes
axes::Axes axes(const pybind11::dict &kwargs = pybind11::dict()); axes::Axes axes(const pybind11::dict &kwargs = pybind11::dict());
...@@ -211,6 +212,11 @@ private: ...@@ -211,6 +212,11 @@ private:
pybind11::object ylim_attr; pybind11::object ylim_attr;
}; };
#ifndef MathPlotLibCPP17_DeclarationOnly #ifndef MathPlotLibCPP17_DeclarationOnly
// close (Figure)
void PyPlot::close(BaseWrapper & obj){
auto refToObject = obj.unwrap();
mod.attr("close")( refToObject);
}
// axes // axes
axes::Axes PyPlot::axes(const pybind11::dict &kwargs) { axes::Axes PyPlot::axes(const pybind11::dict &kwargs) {
pybind11::object ax_obj = axes_attr(**kwargs); pybind11::object ax_obj = axes_attr(**kwargs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment