Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matplotlibcpp17
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HKHLR
matplotlibcpp17
Commits
e79a2869
Commit
e79a2869
authored
1 year ago
by
Iwainsky, Christian
Browse files
Options
Downloads
Patches
Plain Diff
added close function to close figures
parent
a6e3790a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/matplotlibcpp17/figure.h
+8
-3
8 additions, 3 deletions
include/matplotlibcpp17/figure.h
include/matplotlibcpp17/pyplot.h
+6
-0
6 additions, 0 deletions
include/matplotlibcpp17/pyplot.h
with
14 additions
and
3 deletions
include/matplotlibcpp17/figure.h
+
8
−
3
View file @
e79a2869
...
@@ -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();
...
...
This diff is collapsed.
Click to expand it.
include/matplotlibcpp17/pyplot.h
+
6
−
0
View file @
e79a2869
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment