diff --git a/gallery/artist_animation/animate_decay.cpp b/gallery/artist_animation/animate_decay.cpp index 85420ad1d44e72a32bb0baa5fb2c56066d01c593..a8571983ef6e2c2c8334832310d83a1fbcf891ed 100644 --- a/gallery/artist_animation/animate_decay.cpp +++ b/gallery/artist_animation/animate_decay.cpp @@ -1,18 +1,11 @@ // example from // https://matplotlib.org/stable/gallery/animation/animate_decay.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/animation.h> #include <vector> -#include <algorithm> -#include <string> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; using matplotlibcpp17::animation::ArtistAnimation; diff --git a/gallery/artist_animation/cla_pause.cpp b/gallery/artist_animation/cla_pause.cpp index 29d233e48e2285ebf12030eb763818d129c0c597..8251a64c1d72190c7a6f20e5214df52142866324 100644 --- a/gallery/artist_animation/cla_pause.cpp +++ b/gallery/artist_animation/cla_pause.cpp @@ -1,14 +1,7 @@ -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <vector> -#include <algorithm> -#include <string> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/artist_animation/random_walk.cpp b/gallery/artist_animation/random_walk.cpp index f67ea0b75a1de3451a2c25194bd6773c177775bb..a3dcac501fb43fd52957369020380f333dc0fae7 100644 --- a/gallery/artist_animation/random_walk.cpp +++ b/gallery/artist_animation/random_walk.cpp @@ -1,8 +1,5 @@ // example from https://matplotlib.org/stable/gallery/animation/random_walk.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/animation.h> @@ -12,8 +9,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; using matplotlibcpp17::animation::ArtistAnimation; diff --git a/gallery/images_contours_and_fields/quiver_demo.cpp b/gallery/images_contours_and_fields/quiver_demo.cpp index 9d46343e6138d4c0c882244f2e5774de43d26a23..bea4f82113f683da0def5e022be8104dc3157207 100644 --- a/gallery/images_contours_and_fields/quiver_demo.cpp +++ b/gallery/images_contours_and_fields/quiver_demo.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/images_contours_and_fields/quiver_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/quiver.h> @@ -13,8 +10,6 @@ #include <vector> #include <string> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/bar_label_demo.cpp b/gallery/lines_bars_and_markers/bar_label_demo.cpp index 95b036007dcf8a3c7ddfbd0aa119cc5d4738d168..60a213b2aa637cb9bf03246e6c402ae5e6065274 100644 --- a/gallery/lines_bars_and_markers/bar_label_demo.cpp +++ b/gallery/lines_bars_and_markers/bar_label_demo.cpp @@ -1,21 +1,13 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_label_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <algorithm> #include <vector> #include <iomanip> -#include <iostream> - -namespace py = pybind11; -using namespace py::literals; using namespace std; - using namespace matplotlibcpp17; int main1() { diff --git a/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp b/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp index 963135f1056ab334f6699e39c3f9907f8f428ef7..10fa71e96f16a6d64274b60e280f2ace44fa5938 100644 --- a/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp +++ b/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp @@ -1,9 +1,6 @@ // example // https://matplotlib.org/stable/gallery/lines_bars_and_markers/errorbar_limits_simple.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/errorbar_subsample.cpp b/gallery/lines_bars_and_markers/errorbar_subsample.cpp index 4b54b1f76f0abdeeacefacc2cb518555fef8e70b..f9a08d3ec89a445d26857edbb2ed7c7e4f4a6be5 100644 --- a/gallery/lines_bars_and_markers/errorbar_subsample.cpp +++ b/gallery/lines_bars_and_markers/errorbar_subsample.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/errorbar_subsample.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/fill.cpp b/gallery/lines_bars_and_markers/fill.cpp index 6bc6bdb12faf37e08890088993cd78c3c466fbe3..0e763c85d1f60620262c0611b1815739dd6535a0 100644 --- a/gallery/lines_bars_and_markers/fill.cpp +++ b/gallery/lines_bars_and_markers/fill.cpp @@ -1,17 +1,12 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/fill.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xarray.hpp> #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/fill_between_demo.cpp b/gallery/lines_bars_and_markers/fill_between_demo.cpp index baf6654cc0f0fd1d580ae5f474558012a435be8b..1e4e0b3728046b96bca37480e57a01e87ac1d86c 100644 --- a/gallery/lines_bars_and_markers/fill_between_demo.cpp +++ b/gallery/lines_bars_and_markers/fill_between_demo.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/fill_between_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,12 +8,8 @@ #include <xtensor/xio.hpp> #include <vector> -#include <iostream> -#include <iterator> #include <algorithm> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp b/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp index d90fe4b32fcb36621ae84c3ae04702a3ea21ec0c..eefa7a3bcc179524b4391089f829fb3581ea8fc8 100644 --- a/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp +++ b/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/fill_betweenx_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/scatter_hist.cpp b/gallery/lines_bars_and_markers/scatter_hist.cpp index 706b55f80f8dca0372502fc54235d0cb8ce6e8b1..5118a3044acd62fb3cf16e83107954bf7c559b4b 100644 --- a/gallery/lines_bars_and_markers/scatter_hist.cpp +++ b/gallery/lines_bars_and_markers/scatter_hist.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/scatter_hist.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xrandom.hpp> @@ -12,8 +9,6 @@ #include <vector> #include <algorithm> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/scatter_symbol.cpp b/gallery/lines_bars_and_markers/scatter_symbol.cpp index 56db26634d63f27ab5e6ab33c13c712aa6716d22..8c82d8185eeb60428ef4739a42a0db436c221762 100644 --- a/gallery/lines_bars_and_markers/scatter_symbol.cpp +++ b/gallery/lines_bars_and_markers/scatter_symbol.cpp @@ -1,18 +1,11 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/scatter_symbol.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> -#include <algorithm> #include <vector> #include <string> -namespace py = pybind11; -using namespace py::literals; - template <typename T> std::vector<T> arange(T start, T end, T h) { int N = static_cast<int>((end - start) / h); std::vector<T> xs(N); diff --git a/gallery/lines_bars_and_markers/scatter_with_legend.cpp b/gallery/lines_bars_and_markers/scatter_with_legend.cpp index 50025a336d8b68a2a83cdf7f8d0a44280ff75533..57d97d53d6e0b240e9ffcdcf4d888fabadbf1106 100644 --- a/gallery/lines_bars_and_markers/scatter_with_legend.cpp +++ b/gallery/lines_bars_and_markers/scatter_with_legend.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/scatter_with_legend.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xrandom.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/lines_bars_and_markers/simple_plot.cpp b/gallery/lines_bars_and_markers/simple_plot.cpp index d0e58431846d6461eafd4d787baf268a635eac72..ed7b2343016f3bb50c2e6e413c49190a91726be8 100644 --- a/gallery/lines_bars_and_markers/simple_plot.cpp +++ b/gallery/lines_bars_and_markers/simple_plot.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/contour3d.cpp b/gallery/mplot3d/contour3d.cpp index bb02ae1de60e8ebb64452dba5b6ac34f41265dd4..85fe0d47372e4a182e7044544608d56b499ba3f9 100644 --- a/gallery/mplot3d/contour3d.cpp +++ b/gallery/mplot3d/contour3d.cpp @@ -1,19 +1,12 @@ // example https://matplotlib.org/stable/gallery/mplot3d/contour3d.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> #include <xtensor/xmath.hpp> -#include <xtensor/xio.hpp> -#include <xtensor/xadapt.hpp> #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/errorbar3d.cpp b/gallery/mplot3d/errorbar3d.cpp index b5bf7c39b4930c39330929c29c9518467f3c261a..283a0bbddc9aa60424bb33bf1e0e6f1e7748c5fd 100644 --- a/gallery/mplot3d/errorbar3d.cpp +++ b/gallery/mplot3d/errorbar3d.cpp @@ -1,8 +1,5 @@ // example from https://matplotlib.org/stable/gallery/mplot3d/errorbar3d.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> #include <algorithm> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/lines3d.cpp b/gallery/mplot3d/lines3d.cpp index 0d91953eafc7a344300b106bf659dbceb7097c1d..186502f31a88f603b346ca1af2dab5a25afb5b00 100644 --- a/gallery/mplot3d/lines3d.cpp +++ b/gallery/mplot3d/lines3d.cpp @@ -1,8 +1,5 @@ // example from https://matplotlib.org/stable/gallery/mplot3d/lines3d.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -10,8 +7,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/lorenz_attractor.cpp b/gallery/mplot3d/lorenz_attractor.cpp index e2a4669733940e5e972ba9bfaa7ac946db53552e..562b6ae4a9cb36aacebaa73e7e1e3f4f1834ca35 100644 --- a/gallery/mplot3d/lorenz_attractor.cpp +++ b/gallery/mplot3d/lorenz_attractor.cpp @@ -1,15 +1,10 @@ // example from // https://matplotlib.org/stable/gallery/mplot3d/lorenz_attractor.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> #include <matplotlibcpp17/pyplot.h> -#include <algorithm> + #include <vector> -#include <tuple> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/subplot3d.cpp b/gallery/mplot3d/subplot3d.cpp index 93d6d76c1e7ec20107f3b58e440e806673e4f0a9..8f9f63964ca0b9f5ab19d6a2ce365733a217b93d 100644 --- a/gallery/mplot3d/subplot3d.cpp +++ b/gallery/mplot3d/subplot3d.cpp @@ -1,9 +1,5 @@ // example https://matplotlib.org/stable/gallery/mplot3d/subplot3d.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> -#include <pybind11/numpy.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/cm.h> @@ -12,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/mplot3d/surface3d.cpp b/gallery/mplot3d/surface3d.cpp index 1454f2e1338879ab75dc12e2decb1e91e4b6b672..2553bd9fad599cc916b2eaa041498ca61a21c907 100644 --- a/gallery/mplot3d/surface3d.cpp +++ b/gallery/mplot3d/surface3d.cpp @@ -1,9 +1,5 @@ // example from https://matplotlib.org/stable/gallery/mplot3d/surface3d.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> -#include <pybind11/numpy.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/cm.h> @@ -12,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/shapes_and_collections/patch_collection.cpp b/gallery/shapes_and_collections/patch_collection.cpp index f51636077b5ce4d123e0d2f62da0171874794a1d..ea5be4e9c96c0117d17925ff98cfbbec71241138 100644 --- a/gallery/shapes_and_collections/patch_collection.cpp +++ b/gallery/shapes_and_collections/patch_collection.cpp @@ -1,10 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/shapes_and_collections/patch_collection.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> -#include <pybind11/numpy.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/patches.h> @@ -12,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17::patches; using namespace matplotlibcpp17; diff --git a/gallery/shapes_and_collections/patches_circle_rectangle.cpp b/gallery/shapes_and_collections/patches_circle_rectangle.cpp index bd267da00b84bc5d2bc85437b1b54c1e19e12a8f..d3066da72da770f57d281dd865dcfe8e444f0c0c 100644 --- a/gallery/shapes_and_collections/patches_circle_rectangle.cpp +++ b/gallery/shapes_and_collections/patches_circle_rectangle.cpp @@ -1,17 +1,11 @@ // example from https://note.nkmk.me/python-matplotlib-patches-circle-rectangle -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <matplotlibcpp17/patches.h> #include <algorithm> -#include <iostream> #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; using namespace matplotlibcpp17::patches; diff --git a/gallery/statistics/errorbar.cpp b/gallery/statistics/errorbar.cpp index 28f74f83c7a6e0aeacb2e73b98d610de7b3617ad..5357a8f8acd2606e057fdd795cbf0004170127a4 100644 --- a/gallery/statistics/errorbar.cpp +++ b/gallery/statistics/errorbar.cpp @@ -1,16 +1,11 @@ // example from https://matplotlib.org/stable/gallery/statistics/errorbar.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xrandom.hpp> #include <random> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/statistics/hist.cpp b/gallery/statistics/hist.cpp index 339bdb924cbc7cf0775851389ab78d7c14905537..70c790f5f6d3dc307b73230c8752c8f46a2aa93e 100644 --- a/gallery/statistics/hist.cpp +++ b/gallery/statistics/hist.cpp @@ -1,16 +1,9 @@ // example from https://matplotlib.org/stable/gallery/statistics/hist.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xrandom.hpp> -#include <random> - -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/subplots_axes_and_figures/align_labels_demo.cpp b/gallery/subplots_axes_and_figures/align_labels_demo.cpp index aa3d9e55d8c6eaeac236ad0c0771589d3883ceac..ac14f543c33aa480f1e5fe33dd29b8c9051e0ada 100644 --- a/gallery/subplots_axes_and_figures/align_labels_demo.cpp +++ b/gallery/subplots_axes_and_figures/align_labels_demo.cpp @@ -1,17 +1,12 @@ // example from // https://matplotlib.org/stable/gallery/subplots_axes_and_figures/align_labels_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using matplotlibcpp17::gridspec::GridSpec; using namespace matplotlibcpp17; diff --git a/gallery/subplots_axes_and_figures/colorbar_placement.cpp b/gallery/subplots_axes_and_figures/colorbar_placement.cpp index 1d14344507c784d89a318f788c3aa69fae6acfc7..9f1e341a172b82fd7db6aa4842ea5f549025c7fe 100644 --- a/gallery/subplots_axes_and_figures/colorbar_placement.cpp +++ b/gallery/subplots_axes_and_figures/colorbar_placement.cpp @@ -1,17 +1,12 @@ // example from // https://matplotlib.org/stable/gallery/subplots_axes_and_figures/colorbar_placement.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xrandom.hpp> #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/subplots_axes_and_figures/gridspec_multicolumn.cpp b/gallery/subplots_axes_and_figures/gridspec_multicolumn.cpp index 3b991984535e5f06002a111d6198271e3050d955..afd2e7e2477687a604b06059390f56ac2ae34b68 100644 --- a/gallery/subplots_axes_and_figures/gridspec_multicolumn.cpp +++ b/gallery/subplots_axes_and_figures/gridspec_multicolumn.cpp @@ -1,18 +1,11 @@ // example from // https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_multicolumn.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <vector> -namespace py = pybind11; -using namespace py::literals; - using namespace std; - using matplotlibcpp17::gridspec::GridSpec; using namespace matplotlibcpp17; diff --git a/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp b/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp index 5daa0ccce67a3398bf890fcc7ee71aee43293f09..b40a8c0e473811bfe81af6ff745e3ae5e79c21bf 100644 --- a/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp +++ b/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp @@ -1,9 +1,6 @@ // example from // https://matplotlib.org/stable/gallery/subplots_axes_and_figures/multiple_figs_demo.html -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <xtensor/xbuilder.hpp> @@ -11,8 +8,6 @@ #include <vector> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/gallery/subplots_axes_and_figures/subplots.cpp b/gallery/subplots_axes_and_figures/subplots.cpp index 074e811879e93ff926fe139b3ba0ba129716ca12..635062d16e02f1c86bf8e3aab1f9a232c59040ff 100644 --- a/gallery/subplots_axes_and_figures/subplots.cpp +++ b/gallery/subplots_axes_and_figures/subplots.cpp @@ -1,10 +1,5 @@ -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> -namespace py = pybind11; -using namespace py::literals; using namespace std; using namespace matplotlibcpp17; diff --git a/hello_world/hello_world.cpp b/hello_world/hello_world.cpp index 8ae697bccd024cece4ea49f44cd68cdb3c8d66a4..93a4dc76eecac339a912aeebd12b3493c3d452af 100644 --- a/hello_world/hello_world.cpp +++ b/hello_world/hello_world.cpp @@ -1,12 +1,7 @@ -#include <pybind11/embed.h> -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <vector> -using namespace pybind11::literals; - int main() { pybind11::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index be8fe533c3625b26548e1866c2fe18e03c43a3ee..187dca49d44e0e6ea74f853cacab7027f2ef9398 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -243,9 +243,10 @@ private: LOAD_FUNC_ATTR(plot, self); // NOTE: only when called with projection='3d', `plot_surface`, `plot_wireframe`, `set_zlabel` prop exists. try { - plot_surface_attr = self.attr("plot_surface"); - plot_wireframe_attr = self.attr("plot_wireframe"); - set_zlabel_attr = self.attr("set_zlabel"); + LOAD_FUNC_ATTR(plot_surface, self); + LOAD_FUNC_ATTR(plot_wireframe, self); + LOAD_FUNC_ATTR(set_zlabel, self); + LOAD_FUNC_ATTR(set_zlim, self); INFO_MSG("Loaded Axes3D"); projection_3d = true; } catch (...) { @@ -264,7 +265,6 @@ private: LOAD_FUNC_ATTR(set_ylabel, self); LOAD_FUNC_ATTR(set_ylim, self); LOAD_FUNC_ATTR(set_yticks, self); - LOAD_FUNC_ATTR(set_zlim, self); LOAD_FUNC_ATTR(text, self); LOAD_FUNC_ATTR(tick_params, self); } diff --git a/include/matplotlibcpp17/pyplot.h b/include/matplotlibcpp17/pyplot.h index 59a6aa2a99ada79b5a49b825f89d02123b0a4014..1fb7d03748060a6f8716bd6bac69ca1d0ac09b47 100644 --- a/include/matplotlibcpp17/pyplot.h +++ b/include/matplotlibcpp17/pyplot.h @@ -13,6 +13,9 @@ #include <matplotlibcpp17/figure.h> #include <pybind11/pybind11.h> +#include <pybind11/embed.h> +#include <pybind11/stl.h> +#include <pybind11/numpy.h> namespace matplotlibcpp17::pyplot { @@ -364,10 +367,15 @@ PyPlot import() { } // namespace matplotlibcpp17::pyplot +// Args & Kwargs template <typename... ArgsT> pybind11::tuple Args(ArgsT &&... args) { return pybind11::make_tuple(std::forward<ArgsT>(args)...); } using Kwargs = pybind11::dict; +// Export this +namespace py = pybind11; +using namespace py::literals; + #endif /* MATPLOTLIBCPP17_PYPLOT_H */ diff --git a/tests/test_shared_lib/test_lib.cpp b/tests/test_shared_lib/test_lib.cpp index 3eae2d982c46d8774fe500d2d5d6a84ad702aa93..ab6f4fb2e2c1a7aa81bae9917e8375912bc62a14 100644 --- a/tests/test_shared_lib/test_lib.cpp +++ b/tests/test_shared_lib/test_lib.cpp @@ -1,16 +1,11 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <algorithm> #include <vector> -namespace py = pybind11; -using namespace py::literals; - template <typename T> std::vector<T> arange(T start, T end, T h) { int N = static_cast<int>((end - start) / h); std::vector<T> xs(N); diff --git a/tests/test_static_lib/test_lib.cpp b/tests/test_static_lib/test_lib.cpp index 3eae2d982c46d8774fe500d2d5d6a84ad702aa93..ab6f4fb2e2c1a7aa81bae9917e8375912bc62a14 100644 --- a/tests/test_static_lib/test_lib.cpp +++ b/tests/test_static_lib/test_lib.cpp @@ -1,16 +1,11 @@ // example from // https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html -#include <pybind11/stl.h> - #include <matplotlibcpp17/pyplot.h> #include <algorithm> #include <vector> -namespace py = pybind11; -using namespace py::literals; - template <typename T> std::vector<T> arange(T start, T end, T h) { int N = static_cast<int>((end - start) / h); std::vector<T> xs(N);