matplotlibcpp17
collections.h
1
5#pragma once
6
7#include <utility>
8
9#include <matplotlibcpp17/common.h>
10
11#include <pybind11/pybind11.h>
12
13namespace matplotlibcpp17::collections {
14
18struct DECL_STRUCT_ATTR PathCollection : public BaseWrapper {
19public:
20 PathCollection(const pybind11::object &pathcollection) {
21 self = pathcollection;
22 load_attrs();
23 }
24 PathCollection(pybind11::object &&pathcollection) {
25 self = std::move(pathcollection);
26 load_attrs();
27 }
28
29 // legend_elements
30 std::pair<ObjectWrapper, ObjectWrapper>
31 legend_elements(const pybind11::tuple &args = pybind11::tuple(),
32 const pybind11::dict &kwargs = pybind11::dict());
33
34private:
35 void load_attrs() { LOAD_FUNC_ATTR(legend_elements, self); }
36 pybind11::object legend_elements_attr;
37};
38
39// legend_elements
42inline std::pair<ObjectWrapper, ObjectWrapper>
43PathCollection::legend_elements(const pybind11::tuple &args,
44 const pybind11::dict &kwargs) {
45 pybind11::list ret = legend_elements_attr(*args, **kwargs);
46 pybind11::object handles = ret[0];
47 pybind11::object labels = ret[1];
48 return {ObjectWrapper(std::move(handles)), ObjectWrapper(std::move(labels))};
49}
50
54struct DECL_STRUCT_ATTR PatchCollection : public BaseWrapper {
55public:
56 PatchCollection(const pybind11::tuple &args = pybind11::tuple(),
57 const pybind11::dict &kwargs = pybind11::dict()) {
58 pybind11::object attr = pybind11::module::import("matplotlib.collections")
59 .attr("PatchCollection");
60 self = attr(*args, **kwargs);
61 load_attrs();
62 }
63
64 // set_array
65 ObjectWrapper set_array(const pybind11::tuple &args = pybind11::tuple(),
66 const pybind11::dict &kwargs = pybind11::dict());
67
68private:
69 void load_attrs() { LOAD_FUNC_ATTR(set_array, self); }
70 pybind11::object set_array_attr;
71};
72
73inline ObjectWrapper PatchCollection::set_array(const pybind11::tuple &args,
74 const pybind11::dict &kwargs) {
75 pybind11::object ret = set_array_attr(*args, **kwargs);
76 return ObjectWrapper(std::move(ret));
77}
78
82struct DECL_STRUCT_ATTR QuadMesh : public BaseWrapper {
83public:
84 QuadMesh(const pybind11::object &quadmesh) { self = quadmesh; }
85 QuadMesh(pybind11::object &&quadmesh) { self = std::move(quadmesh); }
86};
87
88} // namespace matplotlibcpp17::collections
A base class for python wrapper classes.
Definition: common.h:39
A proxy class for pybind object.
Definition: common.h:50
A wrapper class for matplotlib.collections.PatchCollection.
Definition: collections.h:54
A wrapper class for matplotlib.collections.PathCollection.
Definition: collections.h:18
std::pair< ObjectWrapper, ObjectWrapper > legend_elements(const pybind11::tuple &args=pybind11::tuple(), const pybind11::dict &kwargs=pybind11::dict())
Definition: collections.h:43
A wrapper class for matplotlib.collections.QuadMesh.
Definition: collections.h:82