From bb9e692c1b48b83069e2bb0e17354098b841304f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hock?= Date: Mon, 17 Oct 2022 03:01:39 +0200 Subject: [PATCH 01/10] Add additional functions (#23) * Add imshow function * Add clim function * Add gci function * Add colorbar function * Add sombrero example --- gallery/contrib/sombrero,cpp | 35 +++++++++++++++++++++ gallery/contrib/sombrero.png | Bin 0 -> 46100 bytes include/matplotlibcpp17/pyplot.h | 52 +++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 gallery/contrib/sombrero,cpp create mode 100644 gallery/contrib/sombrero.png diff --git a/gallery/contrib/sombrero,cpp b/gallery/contrib/sombrero,cpp new file mode 100644 index 0000000..8b03ff3 --- /dev/null +++ b/gallery/contrib/sombrero,cpp @@ -0,0 +1,35 @@ +#include +#include + +int main() +{ + pybind11::scoped_interpreter guard{}; + + const int size = 1000; + const double sigma = 100; + + const auto i = nc::arange(size) - (0.5 * size); + const auto [x, y] = nc::meshgrid(i, i); + + const auto xy = (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2)); + + const auto sombrero = nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4)); + const auto pysombrero = nc::pybindInterface::nc2pybind(sombrero); + + const auto min = nc::min(sombrero)[0]; + const auto max = nc::max(sombrero)[0]; + + auto plt = matplotlibcpp17::pyplot::import(); + + plt.imshow(Args(pysombrero), Kwargs( + "extent"_a = pybind11::make_tuple(-1, +1, -1, +1), + "cmap"_a = "inferno")); + + plt.colorbar(); + + plt.clim(pybind11::make_tuple(min * 0.8, max * 0.8)); + + plt.show(); + + return 0; +} \ No newline at end of file diff --git a/gallery/contrib/sombrero.png b/gallery/contrib/sombrero.png new file mode 100644 index 0000000000000000000000000000000000000000..16c7610055a537d156f0c2fcb3567fd7cb993fe5 GIT binary patch literal 46100 zcmeFYcT`ht_coY7fY2dy2)#M1S2- z&kO`2LxVuzStup&n=6Bp3&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8SmO-K^2yRIel+ly*dSM`{9Cuf_HAijdbI!X~(ZY zqsgoMQTP z7^kHi^s}?`kgZEe&%Ai-)2Hk=S^=3>_l|C4uy+x*WkoD!7e^o3mFe3Zl8CfH)&I8##1ft z%^P{we)Zq8p70lEE^{Ng#qPwlYsq&l&Yut2vyVNapn!oyA|Y0eU~3(pkl?npc6()Q zEwi{-PO7OoA4t*q`uZm3=5#MzdfN6@)Yge6u*eFJ03cMn=2F^@TUBAgr>1VfE~p;7 zlTlg8$Hm3f+}g@G>2@gS=j`3mJH&M$5Q+5 z-6Q;(0r{%zb+evSwEp-?JwHW7MQdwo)RQMqz;P;kcm91|-rgHGZhXefvv56RVt&NS{)X~$+DlByA74dLB%Hz^s5q`PI zvc{z(tD=GzV6l0E0+VI1WW!!5+1?_43cM{X+< zCKIc^^^J|fnwo_1zJ<1QO%oH7p!#|pKvLL(-3L(fUdLH5-X|O#C0SWnV`F0jfBY~_ z&k}3wWJHa(rR!lZ6@>R=;5Nplr^mntCp=VNzIrt{P!pnIKX>ZgoPcIPMotc`fq_9- zc)0fI(|hwTy)o9T>s!{E_Eg~w=;|a)ALb<$zIhYU?r`5IJLHe^CI5Jbk7g$4&SfMK z{`?7_nQ=z0`TF&yzwP(#?!5^u_Y)I2?d*`^kMCz@3c~|6bn5%~@uU8kGbhc>c@cjUl3On-EBnUNU}0uBK}ugXEG9Tdy3k%b?;hi1R1W}9k8 RSv(5<7@RWFDLi2v{6Ckv3OE1& literal 0 HcmV?d00001 diff --git a/include/matplotlibcpp17/pyplot.h b/include/matplotlibcpp17/pyplot.h index 9e8da89..7fa4ca0 100644 --- a/include/matplotlibcpp17/pyplot.h +++ b/include/matplotlibcpp17/pyplot.h @@ -44,6 +44,14 @@ struct DECL_STRUCT_ATTR PyPlot { pybind11::object clf(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // clim + pybind11::object clim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + + // colorbar + pybind11::object colorbar(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + // errorbar pybind11::object errorbar(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -65,10 +73,18 @@ struct DECL_STRUCT_ATTR PyPlot { figure::Figure gcf(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // gci + pybind11::object gci(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + // grid pybind11::object grid(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // imshow + pybind11::object imshow(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + // legend pybind11::object legend(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -137,12 +153,16 @@ struct DECL_STRUCT_ATTR PyPlot { LOAD_FUNC_ATTR(axis, mod); LOAD_FUNC_ATTR(cla, mod); LOAD_FUNC_ATTR(clf, mod); + LOAD_FUNC_ATTR(clim, mod); + LOAD_FUNC_ATTR(colorbar, mod); LOAD_FUNC_ATTR(errorbar, mod); LOAD_FUNC_ATTR(figaspect, mod); LOAD_FUNC_ATTR(figure, mod); LOAD_FUNC_ATTR(gca, mod); LOAD_FUNC_ATTR(gcf, mod); + LOAD_FUNC_ATTR(gci, mod); LOAD_FUNC_ATTR(grid, mod); + LOAD_FUNC_ATTR(imshow, mod); LOAD_FUNC_ATTR(legend, mod); LOAD_FUNC_ATTR(pause, mod); LOAD_FUNC_ATTR(plot, mod); @@ -164,12 +184,16 @@ struct DECL_STRUCT_ATTR PyPlot { pybind11::object axis_attr; pybind11::object cla_attr; pybind11::object clf_attr; + pybind11::object clim_attr; + pybind11::object colorbar_attr; pybind11::object errorbar_attr; pybind11::object figaspect_attr; pybind11::object figure_attr; pybind11::object gca_attr; pybind11::object gcf_attr; + pybind11::object gci_attr; pybind11::object grid_attr; + pybind11::object imshow_attr; pybind11::object legend_attr; pybind11::object pause_attr; pybind11::object plot_attr; @@ -214,6 +238,20 @@ pybind11::object PyPlot::clf(const pybind11::tuple &args, return ret; } +// clim +pybind11::object PyPlot::clim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = clim_attr(*args, **kwargs); + return ret; +} + +// colorbar +pybind11::object PyPlot::colorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = colorbar_attr(*args, **kwargs); + return ret; +} + // errorbar pybind11::object PyPlot::errorbar(const pybind11::tuple &args, const pybind11::dict &kwargs) { @@ -251,6 +289,13 @@ figure::Figure PyPlot::gcf(const pybind11::tuple &args, return figure::Figure(obj); } +// gci +pybind11::object PyPlot::gci(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object obj = gci_attr(*args, **kwargs); + return obj; +} + // grid pybind11::object PyPlot::grid(const pybind11::tuple &args, const pybind11::dict &kwargs) { @@ -258,6 +303,13 @@ pybind11::object PyPlot::grid(const pybind11::tuple &args, return obj; } +// imshow +pybind11::object PyPlot::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object obj = imshow_attr(*args, **kwargs); + return obj; +} + // legend pybind11::object PyPlot::legend(const pybind11::tuple &args, const pybind11::dict &kwargs) { From 8490dcfa8db4c5298b7cfb2dc8e15d1ecfc91c18 Mon Sep 17 00:00:00 2001 From: soblin Date: Sat, 22 Oct 2022 08:20:59 +0900 Subject: [PATCH 02/10] renamed sombrero.cpp Signed-off-by: soblin --- gallery/contrib/{sombrero,cpp => sombrero.cpp} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename gallery/contrib/{sombrero,cpp => sombrero.cpp} (62%) diff --git a/gallery/contrib/sombrero,cpp b/gallery/contrib/sombrero.cpp similarity index 62% rename from gallery/contrib/sombrero,cpp rename to gallery/contrib/sombrero.cpp index 8b03ff3..c7c5b00 100644 --- a/gallery/contrib/sombrero,cpp +++ b/gallery/contrib/sombrero.cpp @@ -1,8 +1,7 @@ #include #include -int main() -{ +int main() { pybind11::scoped_interpreter guard{}; const int size = 1000; @@ -11,9 +10,11 @@ int main() const auto i = nc::arange(size) - (0.5 * size); const auto [x, y] = nc::meshgrid(i, i); - const auto xy = (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2)); + const auto xy = + (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2)); - const auto sombrero = nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4)); + const auto sombrero = + nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4)); const auto pysombrero = nc::pybindInterface::nc2pybind(sombrero); const auto min = nc::min(sombrero)[0]; @@ -21,9 +22,9 @@ int main() auto plt = matplotlibcpp17::pyplot::import(); - plt.imshow(Args(pysombrero), Kwargs( - "extent"_a = pybind11::make_tuple(-1, +1, -1, +1), - "cmap"_a = "inferno")); + plt.imshow(Args(pysombrero), + Kwargs("extent"_a = pybind11::make_tuple(-1, +1, -1, +1), + "cmap"_a = "inferno")); plt.colorbar(); From d29f1fb526d8a0ef520a399e3293e6a7d516bfdb Mon Sep 17 00:00:00 2001 From: soblin Date: Sat, 22 Oct 2022 08:27:33 +0900 Subject: [PATCH 03/10] updated CMakeLists.txt Signed-off-by: soblin --- CMakeLists.txt | 16 +++++++--------- gallery/tests/test_shared_lib/CMakeLists.txt | 5 +---- gallery/tests/test_static_lib/CMakeLists.txt | 5 +---- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de4cc9e..5c46a8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,12 +33,6 @@ else() set(MATPLOTLIB_MINOR_VER_GTE_4 1) endif() -target_include_directories( - ${PROJECT_NAME} - INTERFACE $ - $) -target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) - # ############################################################################## # (2) for add_subdirectory # ############################################################################## @@ -89,6 +83,12 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") # create .deb include("${PROJECT_SOURCE_DIR}/cmake/package.cmake") +target_include_directories( + ${PROJECT_NAME} + INTERFACE $ + $) +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) + # ############################################################################## # (4) uninstall # ############################################################################## @@ -125,9 +125,7 @@ endif() function(add_demo name path) add_executable(${name} ${path}) - target_include_directories(${name} PUBLIC ${Python3_INCLUDE_DIRS} - ${matplotlibcpp17_INCLUDE_DIRS}) - target_link_libraries(${name} ${Python3_LIBRARIES} pybind11::embed xtensor) + target_link_libraries(${name} xtensor matplotlibcpp17::matplotlibcpp17) endfunction() if(${ADD_DEMO}) diff --git a/gallery/tests/test_shared_lib/CMakeLists.txt b/gallery/tests/test_shared_lib/CMakeLists.txt index 925d2dc..d677480 100644 --- a/gallery/tests/test_shared_lib/CMakeLists.txt +++ b/gallery/tests/test_shared_lib/CMakeLists.txt @@ -1,10 +1,7 @@ # create library add_library(test_shared_lib SHARED test_lib.cpp) target_compile_options(test_shared_lib PUBLIC "-fPIC") -target_include_directories( - test_shared_lib PUBLIC ${Python3_INCLUDE_DIRS} - ${matplotlibcpp17_INCLUDE_DIRS}) -target_link_libraries(test_shared_lib ${Python3_LIBRARIES} pybind11::embed) +target_link_libraries(test_shared_lib matplotlibcpp17::matplotlibcpp17) # link it add_executable(test_lib_main test_lib_main.cpp) target_link_libraries(test_lib_main test_shared_lib) diff --git a/gallery/tests/test_static_lib/CMakeLists.txt b/gallery/tests/test_static_lib/CMakeLists.txt index 3955dfe..cd128e0 100644 --- a/gallery/tests/test_static_lib/CMakeLists.txt +++ b/gallery/tests/test_static_lib/CMakeLists.txt @@ -1,10 +1,7 @@ # create library add_library(test_static_lib STATIC test_lib.cpp) target_compile_options(test_static_lib PUBLIC "-fPIC") -target_include_directories( - test_static_lib PUBLIC ${Python3_INCLUDE_DIRS} - ${matplotlibcpp17_INCLUDE_DIRS}) -target_link_libraries(test_static_lib ${Python3_LIBRARIES} pybind11::embed) +target_link_libraries(test_static_lib matplotlibcpp17::matplotlibcpp17) # link it add_executable(test_lib_static_main test_lib_main.cpp) target_link_libraries(test_lib_static_main test_static_lib) From b51db0197e92f9098b9c24b726e1d42065d33b9f Mon Sep 17 00:00:00 2001 From: soblin Date: Sat, 22 Oct 2022 09:41:19 +0900 Subject: [PATCH 04/10] added image_demo demo Signed-off-by: soblin --- README.md | 29 +++++++-- gallery/images/image_demo.png | Bin 0 -> 38677 bytes .../images_contours_and_fields/CMakeLists.txt | 4 +- .../images_contours_and_fields/image_demo.cpp | 55 ++++++++++++++++++ include/matplotlibcpp17/axes.h | 18 +++++- 5 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 gallery/images/image_demo.png create mode 100644 gallery/images_contours_and_fields/image_demo.cpp diff --git a/README.md b/README.md index 011c669..9158045 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ gives ![minimal example](./gallery/images/hello_world.png) -### example1 - subplots +### subplots From [gallery/subplots_axes_and_figures/align_labels_demo.cpp](https://github.com/soblin/matplotlibcpp17/blob/master/gallery/subplots_axes_and_figures/align_labels_demo.cpp). @@ -91,7 +91,7 @@ From [gallery/subplots_axes_and_figures/align_labels_demo.cpp](https://github.co ![subplots_axes_and_figures](./gallery/images/align_labels_demo.png) -### example2 - bar plot +### bar plot From [gallery/lines_bars_and_markers/bar_label_demo.cpp](https://github.com/soblin/matplotlibcpp17/blob/master/gallery/lines_bars_and_markers/bar_label_demo.cpp). Here `subplots()` returns `tuple`. @@ -120,7 +120,26 @@ From [gallery/lines_bars_and_markers/bar_label_demo.cpp](https://github.com/sobl ![bar_label_demo1](./gallery/images/bar_label_demo1.png) -### example3 - fill +### image + +2D-style pybind11 array can be plotted as an image using `imshow()` function. + +From [images_contours_and_fields/image_demo](https://github.com/soblin/matplotlibcpp17/blob/master/gallery/images_contours_and_fields/image_demo.cpp) + +- [original python code](https://matplotlib.org/stable/gallery/images_contours_and_fields/image_demo.html) + +```cpp + vector> Z2D{...}; + auto Zpy = py::array(py::cast(std::move(Z2D))); + ax.imshow(Args(Zpy), Kwargs("interpolation"_a = "bilinear", + "cmap"_a = "RdYlGn", "origin"_a = "lower", + "extent"_a = py::make_tuple(-3, 3, -3, 3), + "vmax"_a = vmax, "vmin"_a = vmin)); +``` + +![image_demo](./gallery/images/image_demo.png) + +### fill Fucntions like `subplots`, `TBD`s are overloaded because they return different types depending on the arguments. Here `subplots()` returns `tuple>`. @@ -138,7 +157,7 @@ From [gallery/lines_bars_and_markers](https://github.com/soblin/matplotlibcpp17/ ![fill](./gallery/images/fill.png) -### example4 - quiver +### quiver Use `.unwrap()` method to pass wrapper class of matplotlibcpp17 to plotting functions. @@ -161,7 +180,7 @@ From [gallery/images_contours_and_fields/quiver_demo.cpp](https://github.com/sob ![quiver_demo3](./gallery/images/quiver_demo_3.png) -### example5 - gif +### gif Currently only `ArtistAnimation` is supported. `FuncAnimation` interface maybe implemented in the future. diff --git a/gallery/images/image_demo.png b/gallery/images/image_demo.png new file mode 100644 index 0000000000000000000000000000000000000000..c1e6e1cf3d6c1b2fa530da4ccf7fcfbd5340df19 GIT binary patch literal 38677 zcmeFY^;?tw8$P_jXb=f$=>elbkPZ>45dun=A}Z3L(u@|Q8)>CPQlx8uGzv%!sgWYm zqhayg-k;<9JpaM-)8ldA4ci^B*A?eg=NI=(CF%Dng9Sqp#T7Ig`5=s ziR`b%4g3M*qoMnV9RDwf{8jxIEO+B8!_I={* z1aN!u+SAqJwX5?}?zc|fKF%KQcf_T{rA4`4zJBegC?WCxelPCf{Xzm9_fZc3;0EYw z-h1Six7%s(`HgizW^j_!d595uxZ*$r9F{ChF>id|Rg=Axmrmv(4UY=k@L>#%E?x2~ zR_o0CSD?P=k{F?1iJF?9=o*U@bs4`td3Y0a@1}5qrg4R$ZtT{QOX892zgi0$0?LK z_i|kj!vKIoT5OM6_c;2;_=+0(9WIpc-=PT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SxZX`I~H2oJWh)r$Fh(#V1i~~ie2DnBh&eoWM!XQ z7dy8(D`RMt;`5Nrs$hX4PX&hmA<-XiE6cexco;qd%pj@X!S@%k8)&hzgAqCt8|@W2w0C@h zj*DVDkorwJzT|TE*&5sLdn8a>z3vi&@a+h8|BuohlK))KD6Le0%~((YND}@lZ~q@y c1oiEUDX|0kdKPcU0cjw+%Z``GKl-Ns1M8-zp#T5? literal 0 HcmV?d00001 diff --git a/gallery/images_contours_and_fields/CMakeLists.txt b/gallery/images_contours_and_fields/CMakeLists.txt index 56ce421..089c85b 100644 --- a/gallery/images_contours_and_fields/CMakeLists.txt +++ b/gallery/images_contours_and_fields/CMakeLists.txt @@ -1,10 +1,12 @@ add_demo(quiver_demo quiver_demo.cpp) add_demo(contourf_log contourf_log) +add_demo(image_demo image_demo) add_custom_target( images_contours_and_fields - DEPENDS quiver_demo contourf_log + DEPENDS quiver_demo contourf_log image_demo COMMAND quiver_demo COMMAND contourf_log + COMMAND image_demo COMMENT "running images_contours_and_fields" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../images") diff --git a/gallery/images_contours_and_fields/image_demo.cpp b/gallery/images_contours_and_fields/image_demo.cpp new file mode 100644 index 0000000..59a0ace --- /dev/null +++ b/gallery/images_contours_and_fields/image_demo.cpp @@ -0,0 +1,55 @@ +// example from +// https://matplotlib.org/stable/gallery/images_contours_and_fields/image_demo.html + +#include + +#include +#include + +#include +#include +#include + +using namespace std; +using namespace matplotlibcpp17; + +using mesh2D = vector>; + +int main() { + const double delta = 0.025; + const auto x = xt::arange(-3.0, 3.0, delta); + auto [X_, Y_] = xt::meshgrid(x, x); + auto Z1_ = xt::exp(-xt::pow(X_, 2) - xt::pow(Y_, 2)); + auto Z2_ = xt::exp(-xt::pow(X_ - 1, 2) - xt::pow(Y_ - 1, 2)); + auto Z_ = (Z1_ - Z2_) * 2.0; + + // to vector + vector X(X_.begin(), X_.end()), Y(Y_.begin(), Y_.end()), + Z1(Z1_.begin(), Z1_.end()), Z2(Z2_.begin(), Z2_.end()); + // to vector + const int xsz = x.shape()[0], ysz = x.shape()[0]; + mesh2D Z2D(xsz); + for (int i = 0; i < xsz; ++i) { + Z2D[i].resize(ysz); + for (int j = 0; j < ysz; ++j) { + Z2D[i][j] = Z_(i, j); + } + } + + py::scoped_interpreter guard{}; + auto plt = matplotlibcpp17::pyplot::import(); + auto [fig, ax] = plt.subplots(); + const double vmax = *max_element(Z_.begin(), Z_.end()), + vmin = *min_element(Z_.begin(), Z_.end()); + auto Zpy = py::array(py::cast(std::move(Z2D))); + ax.imshow(Args(Zpy), Kwargs("interpolation"_a = "bilinear", + "cmap"_a = "RdYlGn", "origin"_a = "lower", + "extent"_a = py::make_tuple(-3, 3, -3, 3), + "vmax"_a = vmax, "vmin"_a = vmin)); +#if USE_GUI + plt.show(); +#else + plt.savefig(Args("image_demo.png")); +#endif + return 0; +} diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index 0970c3b..87f6983 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -118,6 +118,10 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { pybind11::object hist2d(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // imshow + pybind11::object imshow(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + // invert_yaxis pybind11::object invert_yaxis(const pybind11::tuple &args = pybind11::tuple(), @@ -260,10 +264,12 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { LOAD_FUNC_ATTR(hist, self); LOAD_FUNC_ATTR(hist2d, self); LOAD_FUNC_ATTR(invert_yaxis, self); + LOAD_FUNC_ATTR(imshow, self); LOAD_FUNC_ATTR(legend, self); LOAD_FUNC_ATTR(pcolormesh, self); LOAD_FUNC_ATTR(plot, self); - // NOTE: only when called with projection='3d', `plot_surface`, `plot_wireframe`, `set_zlabel` prop exists. + // NOTE: only when called with projection='3d', `plot_surface`, + // `plot_wireframe`, `set_zlabel` prop exists. try { LOAD_FUNC_ATTR(plot_surface, self); LOAD_FUNC_ATTR(plot_wireframe, self); @@ -315,6 +321,7 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { pybind11::object hist_attr; pybind11::object hist2d_attr; pybind11::object invert_yaxis_attr; + pybind11::object imshow_attr; pybind11::object legend_attr; pybind11::object pcolormesh_attr; pybind11::object plot_attr; @@ -463,7 +470,7 @@ pybind11::object Axes::get_lines(const pybind11::tuple &args, pybind11::object Axes::get_xaxis_transform(const pybind11::tuple &args, const pybind11::dict &kwargs) { pybind11::object ret = get_xaxis_transform_attr(*args, **kwargs); - return ret; + return ret; } // get_xlim @@ -522,6 +529,13 @@ pybind11::object Axes::invert_yaxis(const pybind11::tuple &args, return ret; } +// imshow +pybind11::object Axes::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = imshow_attr(*args, **kwargs); + return ret; +} + // legend legend::Legend Axes::legend(const pybind11::tuple &args, const pybind11::dict &kwargs) { From d418287a87a8c48ed10d5c541afa376b03893e3e Mon Sep 17 00:00:00 2001 From: soblin Date: Sun, 23 Oct 2022 02:42:08 +0900 Subject: [PATCH 05/10] changed color name in cm to a static const char Signed-off-by: soblin --- gallery/images_contours_and_fields/contourf_log.cpp | 2 +- gallery/images_contours_and_fields/image_demo.cpp | 3 ++- include/matplotlibcpp17/cm.h | 7 ++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gallery/images_contours_and_fields/contourf_log.cpp b/gallery/images_contours_and_fields/contourf_log.cpp index f90323a..0962e70 100644 --- a/gallery/images_contours_and_fields/contourf_log.cpp +++ b/gallery/images_contours_and_fields/contourf_log.cpp @@ -52,7 +52,7 @@ int main() { auto [fig, ax] = plt.subplots(); auto cs = ax.contourf(Args(Xpy, Ypy, zpy), Kwargs("locator"_a = ticker::LogLocator().unwrap(), - "cmap"_a = cm::PuBu_r())); + "cmap"_a = cm::PuBu_r)); fig.colorbar(Args(cs)); plt.show(); } diff --git a/gallery/images_contours_and_fields/image_demo.cpp b/gallery/images_contours_and_fields/image_demo.cpp index 59a0ace..c152632 100644 --- a/gallery/images_contours_and_fields/image_demo.cpp +++ b/gallery/images_contours_and_fields/image_demo.cpp @@ -2,6 +2,7 @@ // https://matplotlib.org/stable/gallery/images_contours_and_fields/image_demo.html #include +#include #include #include @@ -43,7 +44,7 @@ int main() { vmin = *min_element(Z_.begin(), Z_.end()); auto Zpy = py::array(py::cast(std::move(Z2D))); ax.imshow(Args(Zpy), Kwargs("interpolation"_a = "bilinear", - "cmap"_a = "RdYlGn", "origin"_a = "lower", + "cmap"_a = cm::RdYlGn, "origin"_a = "lower", "extent"_a = py::make_tuple(-3, 3, -3, 3), "vmax"_a = vmax, "vmin"_a = vmin)); #if USE_GUI diff --git a/include/matplotlibcpp17/cm.h b/include/matplotlibcpp17/cm.h index c436e5c..3d7383b 100644 --- a/include/matplotlibcpp17/cm.h +++ b/include/matplotlibcpp17/cm.h @@ -16,11 +16,8 @@ pybind11::object coolwarm() { return ret; } -pybind11::object PuBu_r() { - pybind11::object ret = - pybind11::module::import("matplotlib.cm").attr("PuBu_r"); - return ret; -} +static const char *PuBu_r = "PuBu_r"; +static const char *RdYlGn = "RdYlGn"; } // namespace matplotlibcpp17::cm From 85ba09b9584d2be465b599bcefbc1b88fe5fc62f Mon Sep 17 00:00:00 2001 From: Mamoru Sobue Date: Sun, 23 Oct 2022 08:12:55 +0900 Subject: [PATCH 06/10] Feat/return proxy (#27) * (1) return ObjectWrapper (2) workaround for mplot3d Signed-off-by: soblin * checked all samples working Signed-off-by: soblin * adding const Signed-off-by: soblin * adding const Signed-off-by: soblin Signed-off-by: soblin --- gallery/artist_animation/animate_decay.cpp | 5 +- gallery/artist_animation/random_walk.cpp | 12 +- .../contourf_log.cpp | 18 +- .../images_contours_and_fields/image_demo.cpp | 10 +- .../quiver_demo.cpp | 26 +- .../lines_bars_and_markers/bar_label_demo.cpp | 34 +- .../errorbar_limits_simple.cpp | 10 +- .../errorbar_subsample.cpp | 15 +- gallery/lines_bars_and_markers/fill.cpp | 8 +- .../fill_between_demo.cpp | 20 +- .../fill_betweenx_demo.cpp | 8 +- .../lines_bars_and_markers/scatter_hist.cpp | 12 +- .../lines_bars_and_markers/scatter_symbol.cpp | 10 +- .../scatter_with_legend.cpp | 16 +- .../lines_bars_and_markers/simple_plot.cpp | 6 +- gallery/lines_bars_and_markers/step_demo.cpp | 8 +- gallery/mplot3d/contour3d.cpp | 26 +- gallery/mplot3d/errorbar3d.cpp | 11 +- gallery/mplot3d/lines3d.cpp | 21 +- gallery/mplot3d/lorenz_attractor.cpp | 9 +- gallery/mplot3d/subplot3d.cpp | 49 ++- gallery/mplot3d/surface3d.cpp | 27 +- .../patch_collection.cpp | 7 +- gallery/statistics/errorbar.cpp | 6 +- gallery/statistics/hist.cpp | 14 +- .../align_labels_demo.cpp | 8 +- .../colorbar_placement.cpp | 2 +- .../multiple_figs_demo.cpp | 6 +- .../subplots_axes_and_figures/two_scales.cpp | 8 +- include/matplotlibcpp17/animation.h | 10 +- include/matplotlibcpp17/axes.h | 410 +++++++++--------- include/matplotlibcpp17/cm.h | 7 +- include/matplotlibcpp17/collections.h | 25 +- include/matplotlibcpp17/common.h | 12 +- include/matplotlibcpp17/container.h | 5 +- include/matplotlibcpp17/figure.h | 59 +-- include/matplotlibcpp17/gridspec.h | 5 +- include/matplotlibcpp17/legend.h | 5 +- include/matplotlibcpp17/mplot3d.h | 18 + include/matplotlibcpp17/pyplot.h | 216 ++++----- include/matplotlibcpp17/quiver.h | 6 +- include/matplotlibcpp17/text.h | 17 +- 42 files changed, 635 insertions(+), 572 deletions(-) create mode 100644 include/matplotlibcpp17/mplot3d.h diff --git a/gallery/artist_animation/animate_decay.cpp b/gallery/artist_animation/animate_decay.cpp index a857198..26c4210 100644 --- a/gallery/artist_animation/animate_decay.cpp +++ b/gallery/artist_animation/animate_decay.cpp @@ -27,9 +27,8 @@ int main() { auto [xmin, xmax] = ax.get_xlim(); if (t >= xmax) ax.set_xlim(Args(xmin, 2 * xmax)); - py::object line = - ax.plot(Args(ts, ys), Kwargs("color"_a = "blue", "lw"_a = 1)); - artist_list.append(line); + auto line = ax.plot(Args(ts, ys), Kwargs("color"_a = "blue", "lw"_a = 1)); + artist_list.append(line.unwrap()); } auto ani = ArtistAnimation(Args(fig.unwrap(), artist_list), Kwargs("interval"_a = 10)); diff --git a/gallery/artist_animation/random_walk.cpp b/gallery/artist_animation/random_walk.cpp index a3dcac5..3fc12ee 100644 --- a/gallery/artist_animation/random_walk.cpp +++ b/gallery/artist_animation/random_walk.cpp @@ -1,7 +1,9 @@ // example from https://matplotlib.org/stable/gallery/animation/random_walk.html +#include #include #include +#include #include #include @@ -32,21 +34,23 @@ int main() { } py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto fig = plt.figure(); auto ax = fig.add_subplot(py::make_tuple(), Kwargs("projection"_a = "3d")); py::list artist_list; for (int j = 1; j <= num_steps; ++j) { for (int i = 0; i < M; ++i) { - auto xs0 = xt::view(walks, i, 0, xt::range(1, j + 1)); - auto ys0 = xt::view(walks, i, 1, xt::range(1, j + 1)); - auto zs0 = xt::view(walks, i, 2, xt::range(1, j + 1)); + const auto xs0 = xt::view(walks, i, 0, xt::range(1, j + 1)); + const auto ys0 = xt::view(walks, i, 1, xt::range(1, j + 1)); + const auto zs0 = xt::view(walks, i, 2, xt::range(1, j + 1)); // to vector vector xs(xs0.begin(), xs0.end()); vector ys(ys0.begin(), ys0.end()); vector zs(zs0.begin(), zs0.end()); ax.plot(Args(xs, ys, zs), Kwargs("color"_a = colors[i])); } - artist_list.append(ax.get_lines()); + artist_list.append(ax.get_lines().unwrap()); } auto ani = ArtistAnimation(Args(fig.unwrap(), artist_list), Kwargs("interval"_a = 100)); diff --git a/gallery/images_contours_and_fields/contourf_log.cpp b/gallery/images_contours_and_fields/contourf_log.cpp index 0962e70..38ced46 100644 --- a/gallery/images_contours_and_fields/contourf_log.cpp +++ b/gallery/images_contours_and_fields/contourf_log.cpp @@ -19,12 +19,12 @@ using mesh2D = vector>; int main() { const int N = 100; - auto x_ = xt::linspace(-3.0, 3.0, N); - auto y_ = xt::linspace(-2.0, 2.0, N); + const auto x_ = xt::linspace(-3.0, 3.0, N); + const auto y_ = xt::linspace(-2.0, 2.0, N); - auto [X_, Y_] = xt::meshgrid(x_, y_); - auto Z1_ = xt::exp(-xt::pow(X_, 2) - xt::pow(Y_, 2)); - auto Z2_ = xt::exp(-xt::pow(X_ * 10, 2) - xt::pow(Y_ * 10, 2)); + const auto [X_, Y_] = xt::meshgrid(x_, y_); + const auto Z1_ = xt::exp(-xt::pow(X_, 2) - xt::pow(Y_, 2)); + const auto Z2_ = xt::exp(-xt::pow(X_ * 10, 2) - xt::pow(Y_ * 10, 2)); xt::xarray z_ = Z1_ + 50 * Z2_; // instead of x[:5, :5] = -1.0 auto v = xt::view(z_, xt::range(_, 5), xt::range(_, 5)); @@ -45,14 +45,14 @@ int main() { py::scoped_interpreter guard{}; // to numpy array - auto Xpy = py::array(py::cast(std::move(X))); - auto Ypy = py::array(py::cast(std::move(Y))); - auto zpy = py::array(py::cast(std::move(z))); + const auto Xpy = py::array(py::cast(std::move(X))); + const auto Ypy = py::array(py::cast(std::move(Y))); + const auto zpy = py::array(py::cast(std::move(z))); auto plt = pyplot::import(); auto [fig, ax] = plt.subplots(); auto cs = ax.contourf(Args(Xpy, Ypy, zpy), Kwargs("locator"_a = ticker::LogLocator().unwrap(), "cmap"_a = cm::PuBu_r)); - fig.colorbar(Args(cs)); + fig.colorbar(Args(cs.unwrap())); plt.show(); } diff --git a/gallery/images_contours_and_fields/image_demo.cpp b/gallery/images_contours_and_fields/image_demo.cpp index c152632..c63cfc7 100644 --- a/gallery/images_contours_and_fields/image_demo.cpp +++ b/gallery/images_contours_and_fields/image_demo.cpp @@ -19,10 +19,10 @@ using mesh2D = vector>; int main() { const double delta = 0.025; const auto x = xt::arange(-3.0, 3.0, delta); - auto [X_, Y_] = xt::meshgrid(x, x); - auto Z1_ = xt::exp(-xt::pow(X_, 2) - xt::pow(Y_, 2)); - auto Z2_ = xt::exp(-xt::pow(X_ - 1, 2) - xt::pow(Y_ - 1, 2)); - auto Z_ = (Z1_ - Z2_) * 2.0; + const auto [X_, Y_] = xt::meshgrid(x, x); + const auto Z1_ = xt::exp(-xt::pow(X_, 2) - xt::pow(Y_, 2)); + const auto Z2_ = xt::exp(-xt::pow(X_ - 1, 2) - xt::pow(Y_ - 1, 2)); + const auto Z_ = (Z1_ - Z2_) * 2.0; // to vector vector X(X_.begin(), X_.end()), Y(Y_.begin(), Y_.end()), @@ -42,7 +42,7 @@ int main() { auto [fig, ax] = plt.subplots(); const double vmax = *max_element(Z_.begin(), Z_.end()), vmin = *min_element(Z_.begin(), Z_.end()); - auto Zpy = py::array(py::cast(std::move(Z2D))); + const auto Zpy = py::array(py::cast(std::move(Z2D))); ax.imshow(Args(Zpy), Kwargs("interpolation"_a = "bilinear", "cmap"_a = cm::RdYlGn, "origin"_a = "lower", "extent"_a = py::make_tuple(-3, 3, -3, 3), diff --git a/gallery/images_contours_and_fields/quiver_demo.cpp b/gallery/images_contours_and_fields/quiver_demo.cpp index bea4f82..2deff9f 100644 --- a/gallery/images_contours_and_fields/quiver_demo.cpp +++ b/gallery/images_contours_and_fields/quiver_demo.cpp @@ -14,10 +14,10 @@ using namespace std; using namespace matplotlibcpp17; int main1() { - auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.2), - xt::arange(0.0, 2 * M_PI, 0.2)); - auto U0 = xt::cos(X0); - auto V0 = xt::sin(Y0); + const auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.2), + xt::arange(0.0, 2 * M_PI, 0.2)); + const auto U0 = xt::cos(X0); + const auto V0 = xt::sin(Y0); // to vector vector X(X0.begin(), X0.end()), Y(Y0.begin(), Y0.end()), U(U0.begin(), U0.end()), V(V0.begin(), V0.end()); @@ -38,10 +38,10 @@ int main1() { } int main2() { - auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.6), - xt::arange(0.0, 2 * M_PI, 0.6)); - auto U0 = xt::cos(X0); - auto V0 = xt::sin(Y0); + const auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.6), + xt::arange(0.0, 2 * M_PI, 0.6)); + const auto U0 = xt::cos(X0); + const auto V0 = xt::sin(Y0); // to vector vector X(X0.begin(), X0.end()), Y(Y0.begin(), Y0.end()), U(U0.begin(), U0.end()), V(V0.begin(), V0.end()); @@ -65,11 +65,11 @@ int main2() { } int main3() { - auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.2), - xt::arange(0.0, 2 * M_PI, 0.2)); - auto U0 = xt::cos(X0); - auto V0 = xt::sin(Y0); - auto M0 = xt::hypot(U0, V0); + const auto [X0, Y0] = xt::meshgrid(xt::arange(0.0, 2 * M_PI, 0.2), + xt::arange(0.0, 2 * M_PI, 0.2)); + const auto U0 = xt::cos(X0); + const auto V0 = xt::sin(Y0); + const auto M0 = xt::hypot(U0, V0); vector X(X0.begin(), X0.end()), Y(Y0.begin(), Y0.end()), U(U0.begin(), U0.end()), V(V0.begin(), V0.end()), M(M0.begin(), M0.end()); diff --git a/gallery/lines_bars_and_markers/bar_label_demo.cpp b/gallery/lines_bars_and_markers/bar_label_demo.cpp index 60a213b..adde382 100644 --- a/gallery/lines_bars_and_markers/bar_label_demo.cpp +++ b/gallery/lines_bars_and_markers/bar_label_demo.cpp @@ -11,11 +11,11 @@ using namespace std; using namespace matplotlibcpp17; int main1() { - vector menMeans = {20, 35, 30, 35, -27}; - vector womenMeans = {25, 32, 34, 20, -25}; - vector menStd = {2, 3, 4, 1, 2}; - vector womenStd = {3, 5, 2, 3, 3}; - vector ind = {0, 1, 2, 3, 4}; // the x locations for the groups + const vector menMeans = {20, 35, 30, 35, -27}; + const vector womenMeans = {25, 32, 34, 20, -25}; + const vector menStd = {2, 3, 4, 1, 2}; + const vector womenStd = {3, 5, 2, 3, 3}; + const vector ind = {0, 1, 2, 3, 4}; // the x locations for the groups const double width = 0.35; // the width of the bars: can also be len(x) sequence auto plt = matplotlibcpp17::pyplot::import(); @@ -44,12 +44,12 @@ int main1() { } int main2() { - vector people = {"Tom", "Dick", "Harry", "Slim", "Jim"}; - vector y_pos = {0, 1, 2, 3, 4}; - vector performance = {10.00367304, 10.42750809, 10.09280011, - 8.66745522, 12.77785333}; - vector error = {0.70633485, 0.24791576, 0.15788335, 0.69769852, - 0.71995667}; + const vector people = {"Tom", "Dick", "Harry", "Slim", "Jim"}; + const vector y_pos = {0, 1, 2, 3, 4}; + const vector performance = {10.00367304, 10.42750809, 10.09280011, + 8.66745522, 12.77785333}; + const vector error = {0.70633485, 0.24791576, 0.15788335, 0.69769852, + 0.71995667}; auto plt = matplotlibcpp17::pyplot::import(); auto [fig, ax] = plt.subplots(); auto hbars = ax.barh(Args(y_pos, performance), @@ -71,12 +71,12 @@ int main2() { } int main3() { - vector people = {"Tom", "Dick", "Harry", "Slim", "Jim"}; - vector y_pos = {0, 1, 2, 3, 4}; - vector performance = {10.00367304, 10.42750809, 10.09280011, - 8.66745522, 12.77785333}; - vector error = {0.70633485, 0.24791576, 0.15788335, 0.69769852, - 0.71995667}; + const vector people = {"Tom", "Dick", "Harry", "Slim", "Jim"}; + const vector y_pos = {0, 1, 2, 3, 4}; + const vector performance = {10.00367304, 10.42750809, 10.09280011, + 8.66745522, 12.77785333}; + const vector error = {0.70633485, 0.24791576, 0.15788335, 0.69769852, + 0.71995667}; auto plt = matplotlibcpp17::pyplot::import(); auto [fig, ax] = plt.subplots(); auto hbars = ax.barh(Args(y_pos, performance), diff --git a/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp b/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp index 10fa71e..80c4969 100644 --- a/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp +++ b/gallery/lines_bars_and_markers/errorbar_limits_simple.cpp @@ -15,11 +15,11 @@ int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); auto fig = plt.figure(); - auto x_ = xt::arange(0.0, 10.0, 1.0); - auto y_ = 2.5 * xt::sin(x_ / 20 * M_PI); - auto y1_ = y_ + 1.0, y2_ = y_ + 2.0, y3_ = y_ + 3.0; - auto yerr_ = xt::linspace(0.05, 0.2, 10); - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()), + const auto x_ = xt::arange(0.0, 10.0, 1.0); + const auto y_ = 2.5 * xt::sin(x_ / 20 * M_PI); + const auto y1_ = y_ + 1.0, y2_ = y_ + 2.0, y3_ = y_ + 3.0; + const auto yerr_ = xt::linspace(0.05, 0.2, 10); + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()), yerr(yerr_.begin(), yerr_.end()), y3(y3_.begin(), y3_.end()), y2(y2_.begin(), y2_.end()), y1(y1_.begin(), y1_.end()); plt.errorbar(Args(x, y3), diff --git a/gallery/lines_bars_and_markers/errorbar_subsample.cpp b/gallery/lines_bars_and_markers/errorbar_subsample.cpp index f9a08d3..ebc80b8 100644 --- a/gallery/lines_bars_and_markers/errorbar_subsample.cpp +++ b/gallery/lines_bars_and_markers/errorbar_subsample.cpp @@ -12,12 +12,12 @@ using namespace std; using namespace matplotlibcpp17; int main() { - auto x_ = xt::arange(0.1, 4.0, 0.1); - auto y1_ = xt::exp(-1.0 * x_); - auto y2_ = xt::exp(-0.5 * x_); - auto y1err_ = 0.1 + 0.1 * xt::sqrt(x_); - auto y2err_ = 0.1 + 0.1 * xt::sqrt(x_ / 2.0); - vector x(x_.begin(), x_.end()), y1(y1_.begin(), y1_.end()), + const auto x_ = xt::arange(0.1, 4.0, 0.1); + const auto y1_ = xt::exp(-1.0 * x_); + const auto y2_ = xt::exp(-0.5 * x_); + const auto y1err_ = 0.1 + 0.1 * xt::sqrt(x_); + const auto y2err_ = 0.1 + 0.1 * xt::sqrt(x_ / 2.0); + const vector x(x_.begin(), x_.end()), y1(y1_.begin(), y1_.end()), y2(y2_.begin(), y2_.end()), y1err(y1err_.begin(), y1err_.end()), y2err(y2err_.begin(), y2err_.end()); @@ -34,11 +34,14 @@ int main() { ax1.errorbar(Args(x, y1), Kwargs("yerr"_a = y1err, "errorevery"_a = 6)); ax1.errorbar(Args(x, y2), Kwargs("yerr"_a = y2err, "errorevery"_a = 6)); + // TODO: TypeError: '<' not supported between instances of 'tuple' and 'int' + /* ax2.set_title(Args("second seris shifted by 3")); ax2.errorbar(Args(x, y1), Kwargs("yerr"_a = y1err, "errorevery"_a = py::make_tuple(0, 6))); ax2.errorbar(Args(x, y2), Kwargs("yerr"_a = y2err, "errorevery"_a = py::make_tuple(3, 6))); + */ fig.suptitle(Args("Errorbar subsampling")); #if USE_GUI diff --git a/gallery/lines_bars_and_markers/fill.cpp b/gallery/lines_bars_and_markers/fill.cpp index 0e763c8..cd322ae 100644 --- a/gallery/lines_bars_and_markers/fill.cpp +++ b/gallery/lines_bars_and_markers/fill.cpp @@ -13,10 +13,10 @@ using namespace matplotlibcpp17; int main() { const double scale = 10; const xt::xarray angles = {90.0, 210.0, 330.0}; - auto x0 = scale / sqrt(3.0) * xt::cos(angles / 360.0 * 2 * M_PI); - auto y0 = scale / sqrt(3.0) * xt::sin(angles / 360.0 * 2 * M_PI); - vector x(x0.begin(), x0.end()); - vector y(y0.begin(), y0.end()); + const auto x0 = scale / sqrt(3.0) * xt::cos(angles / 360.0 * 2 * M_PI); + const auto y0 = scale / sqrt(3.0) * xt::sin(angles / 360.0 * 2 * M_PI); + const vector x(x0.begin(), x0.end()); + const vector y(y0.begin(), y0.end()); py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); diff --git a/gallery/lines_bars_and_markers/fill_between_demo.cpp b/gallery/lines_bars_and_markers/fill_between_demo.cpp index 1e4e0b3..ae7337e 100644 --- a/gallery/lines_bars_and_markers/fill_between_demo.cpp +++ b/gallery/lines_bars_and_markers/fill_between_demo.cpp @@ -14,10 +14,10 @@ using namespace std; using namespace matplotlibcpp17; int main1() { - auto x_ = xt::arange(0.0, 2.0, 0.01); - auto y1_ = xt::sin(2 * M_PI * x_); - auto y2_ = 0.8 * xt::sin(4 * M_PI * x_); - vector x(x_.begin(), x_.end()), y1(y1_.begin(), y1_.end()), + const auto x_ = xt::arange(0.0, 2.0, 0.01); + const auto y1_ = xt::sin(2 * M_PI * x_); + const auto y2_ = 0.8 * xt::sin(4 * M_PI * x_); + const vector x(x_.begin(), x_.end()), y1(y1_.begin(), y1_.end()), y2(y2_.begin(), y2_.end()); auto plt = matplotlibcpp17::pyplot::import(); @@ -45,9 +45,9 @@ int main1() { int main2() { auto plt = matplotlibcpp17::pyplot::import(); - vector x = {0, 1, 2, 3}; - vector y1 = {0.8, 0.8, 0.2, 0.2}; - vector y2 = {0, 0, 1, 1}; + const vector x = {0, 1, 2, 3}; + const vector y1 = {0.8, 0.8, 0.2, 0.2}; + const vector y2 = {0, 0, 1, 1}; auto [fig, axs] = plt.subplots(2, 1, Kwargs("sharex"_a = true)); auto ax1 = axs[0], ax2 = axs[1]; @@ -85,8 +85,8 @@ int main3() { auto plt = matplotlibcpp17::pyplot::import(); auto [fig, ax] = plt.subplots(); - auto x0 = xt::arange(0.0, 4 * M_PI, 0.01); - auto y0 = xt::sin(x0); + const auto x0 = xt::arange(0.0, 4 * M_PI, 0.01); + const auto y0 = xt::sin(x0); vector x(x0.begin(), x0.end()), y(y0.begin(), y0.end()); ax.plot(Args(x, y), Kwargs("color"_a = "black")); const double threshold = 0.75; @@ -96,7 +96,7 @@ int main3() { ax.fill_between(Args(x, 0, 1), Kwargs("where"_a = where, "color"_a = "green", "alpha"_a = 0.5, - "transform"_a = ax.get_xaxis_transform())); + "transform"_a = ax.get_xaxis_transform().unwrap())); #if USE_GUI plt.show(); #else diff --git a/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp b/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp index eefa7a3..2a8ad8d 100644 --- a/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp +++ b/gallery/lines_bars_and_markers/fill_betweenx_demo.cpp @@ -13,10 +13,10 @@ using namespace matplotlibcpp17; int main1() { auto plt = matplotlibcpp17::pyplot::import(); - auto y_ = xt::arange(0.0, 2.0, 0.01); - auto x1_ = xt::sin(2 * M_PI * y_); - auto x2_ = 1.2 * xt::sin(4 * M_PI * y_); - vector y(y_.begin(), y_.end()), x1(x1_.begin(), x1_.end()), + const auto y_ = xt::arange(0.0, 2.0, 0.01); + const auto x1_ = xt::sin(2 * M_PI * y_); + const auto x2_ = 1.2 * xt::sin(4 * M_PI * y_); + const vector y(y_.begin(), y_.end()), x1(x1_.begin(), x1_.end()), x2(x2_.begin(), x2_.end()); auto [fig, axes] = plt.subplots( diff --git a/gallery/lines_bars_and_markers/scatter_hist.cpp b/gallery/lines_bars_and_markers/scatter_hist.cpp index 5118a30..1d102c0 100644 --- a/gallery/lines_bars_and_markers/scatter_hist.cpp +++ b/gallery/lines_bars_and_markers/scatter_hist.cpp @@ -14,9 +14,9 @@ using namespace matplotlibcpp17; int main() { int N = 1000; - auto x_ = xt::random::randn({N}); - auto y_ = xt::random::randn({N}); - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); + const auto x_ = xt::random::randn({N}); + const auto y_ = xt::random::randn({N}); + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); // cell1 @@ -40,7 +40,8 @@ int main() { ax_histy.tick_params(Args(), Kwargs("axis"_a = "y", "labelleft"_a = false)); ax.scatter(Args(x, y)); const double binwidth = 0.25; - auto xi = xt::amax(xt::fabs(x_), {0}), yi = xt::amax(xt::fabs(y_), {0}); + const auto xi = xt::amax(xt::fabs(x_), {0}), + yi = xt::amax(xt::fabs(y_), {0}); const double xymax = max(fabs(x_[xi]), fabs(y_[yi])); const double lim = (static_cast(xymax / binwidth) + 1) * binwidth; auto bins_ = xt::arange(-lim, lim + binwidth, binwidth); @@ -73,7 +74,8 @@ int main() { ax_histy.tick_params(Args(), Kwargs("axis"_a = "y", "labelleft"_a = false)); ax.scatter(Args(x, y)); const double binwidth = 0.25; - auto xi = xt::amax(xt::fabs(x_), {0}), yi = xt::amax(xt::fabs(y_), {0}); + const auto xi = xt::amax(xt::fabs(x_), {0}), + yi = xt::amax(xt::fabs(y_), {0}); const double xymax = max(fabs(x_[xi]), fabs(y_[yi])); const double lim = (static_cast(xymax / binwidth) + 1) * binwidth; auto bins_ = xt::arange(-lim, lim + binwidth, binwidth); diff --git a/gallery/lines_bars_and_markers/scatter_symbol.cpp b/gallery/lines_bars_and_markers/scatter_symbol.cpp index 8c82d81..8079b52 100644 --- a/gallery/lines_bars_and_markers/scatter_symbol.cpp +++ b/gallery/lines_bars_and_markers/scatter_symbol.cpp @@ -23,16 +23,16 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); - vector x = {0., 2., 4., 6., 8., 10., 12., 14., 16., - 18., 20., 22., 24., 26., 28., 30., 32., 34., - 36., 38., 40., 42., 44., 46., 48.}; - vector y = { + const vector x = {0., 2., 4., 6., 8., 10., 12., 14., 16., + 18., 20., 22., 24., 26., 28., 30., 32., 34., + 36., 38., 40., 42., 44., 46., 48.}; + const vector y = { 21.01101912, 24.74481311, 27.34126659, 27.27298483, 44.26208785, 41.14266853, 32.72670355, 35.63706738, 57.689303, 64.43917295, 56.86145395, 65.85596686, 91.33222544, 89.93319308, 90.07761828, 104.3101143, 105.86324421, 125.79378295, 127.67869682, 131.83987721, 140.51644988, 140.79566887, 153.22398837, 169.06951457, 174.97156606}; - vector s = { + const vector s = { 736.2911849, 628.75670445, 664.90041181, 607.46030945, 884.4840139, 774.0174507, 790.37543212, 1278.33411095, 588.75488929, 810.61127126, 1126.45270023, 1278.31780809, 886.56768427, 769.13688434, 953.93522899, diff --git a/gallery/lines_bars_and_markers/scatter_with_legend.cpp b/gallery/lines_bars_and_markers/scatter_with_legend.cpp index 57d97d5..ad52ece 100644 --- a/gallery/lines_bars_and_markers/scatter_with_legend.cpp +++ b/gallery/lines_bars_and_markers/scatter_with_legend.cpp @@ -37,19 +37,19 @@ int main1() { int main2() { int N = 45; - auto x_ = xt::random::rand({N}, 0.0, 1.0); - auto y_ = xt::random::rand({N}, 0.0, 1.0); - auto c_ = xt::random::randint({N}, 1, 5); - auto s_ = xt::random::randint({N}, 10, 220); - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); - vector c(c_.begin(), c_.end()), s(s_.begin(), s_.end()); + const auto x_ = xt::random::rand({N}, 0.0, 1.0); + const auto y_ = xt::random::rand({N}, 0.0, 1.0); + const auto c_ = xt::random::randint({N}, 1, 5); + const auto s_ = xt::random::randint({N}, 10, 220); + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); + const vector c(c_.begin(), c_.end()), s(s_.begin(), s_.end()); auto plt = matplotlibcpp17::pyplot::import(); auto [fig, ax] = plt.subplots(); auto scatter = ax.scatter(Args(x, y), Kwargs("c"_a = c, "s"_a = s)); { auto [handles, labels] = scatter.legend_elements(); auto legend1 = - ax.legend(Args(handles, labels), + ax.legend(Args(handles.unwrap(), labels.unwrap()), Kwargs("loc"_a = "lower left", "title"_a = "Classes")); ax.add_artist(Args(legend1.unwrap())); } @@ -57,7 +57,7 @@ int main2() { auto [handles, labels] = scatter.legend_elements( Args(), Kwargs("prop"_a = "sizes", "alpha"_a = 0.6)); auto legend2 = - ax.legend(Args(handles, labels), + ax.legend(Args(handles.unwrap(), labels.unwrap()), Kwargs("loc"_a = "upper right", "title"_a = "Sizes")); } #if USE_GUI diff --git a/gallery/lines_bars_and_markers/simple_plot.cpp b/gallery/lines_bars_and_markers/simple_plot.cpp index ed7b234..f495171 100644 --- a/gallery/lines_bars_and_markers/simple_plot.cpp +++ b/gallery/lines_bars_and_markers/simple_plot.cpp @@ -14,9 +14,9 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); - auto t_ = xt::arange(0.0, 2.0, 0.01); - auto s_ = xt::sin(2 * M_PI * t_) + 1.0; - vector t(t_.begin(), t_.end()), s(s_.begin(), s_.end()); + const auto t_ = xt::arange(0.0, 2.0, 0.01); + const auto s_ = xt::sin(2 * M_PI * t_) + 1.0; + const vector t(t_.begin(), t_.end()), s(s_.begin(), s_.end()); auto [fig, ax] = plt.subplots(); ax.plot(Args(t, s), Kwargs("color"_a = "blue", "linewidth"_a = 1.0)); diff --git a/gallery/lines_bars_and_markers/step_demo.cpp b/gallery/lines_bars_and_markers/step_demo.cpp index e5da76b..05c9c19 100644 --- a/gallery/lines_bars_and_markers/step_demo.cpp +++ b/gallery/lines_bars_and_markers/step_demo.cpp @@ -15,10 +15,10 @@ int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); - auto x_ = xt::arange(14) * 1.0; - auto y_ = xt::sin(x_ / 2.0); - auto y1_ = y_ + 1.0, y2_ = y_ + 2.0; - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()), + const auto x_ = xt::arange(14) * 1.0; + const auto y_ = xt::sin(x_ / 2.0); + const auto y1_ = y_ + 1.0, y2_ = y_ + 2.0; + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()), y1(y1_.begin(), y1_.end()), y2(y2_.begin(), y2_.end()); plt.step(Args(x, y2), Kwargs("label"_a = "pre (default)")); diff --git a/gallery/mplot3d/contour3d.cpp b/gallery/mplot3d/contour3d.cpp index 60912cf..36cdac5 100644 --- a/gallery/mplot3d/contour3d.cpp +++ b/gallery/mplot3d/contour3d.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -17,18 +18,19 @@ using mesh2D = vector>; // from mpl_toolkits.axes3d.py tuple get_test_data(double delta = 0.05) { - auto xs = xt::arange(-3.0, 3.0, delta); - auto ys = xt::arange(-3.0, 3.0, delta); - auto [X0, Y0] = xt::meshgrid(xs, ys); // 120x160 - auto Z1 = xt::exp(-(xt::pow(X0, 2) + xt::pow(Y0, 2)) / 2.0) / (2 * M_PI); - auto Z2 = + const auto xs = xt::arange(-3.0, 3.0, delta); + const auto ys = xt::arange(-3.0, 3.0, delta); + const auto [X0, Y0] = xt::meshgrid(xs, ys); // 120x160 + const auto Z1 = + xt::exp(-(xt::pow(X0, 2) + xt::pow(Y0, 2)) / 2.0) / (2 * M_PI); + const auto Z2 = xt::exp(-(xt::pow((X0 - 1.0) / 1.5, 2) + xt::pow((Y0 - 1.0) / 0.5, 2)) / 2) / (2 * M_PI * 0.5 * 1.5); - auto Z0 = Z2 - Z1; - auto X = X0 * 10; - auto Y = Y0 * 10; - auto Z = Z0 * 500; + const auto Z0 = Z2 - Z1; + const auto X = X0 * 10; + const auto Y = Y0 * 10; + const auto Z = Z0 * 500; const int szx = xs.shape()[0], szy = ys.shape()[0]; mesh2D X_(szx), Y_(szx), Z_(szx); for (int i = 0; i < szx; ++i) { @@ -47,10 +49,12 @@ tuple get_test_data(double delta = 0.05) { int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto fig = plt.figure(); auto ax = fig.add_subplot(Args(), Kwargs("projection"_a = "3d")); - auto [X, Y, Z] = get_test_data(0.05); - ax.contour(Args(X, Y, Z), Kwargs("cmap"_a = cm::coolwarm())); + const auto [X, Y, Z] = get_test_data(0.05); + ax.contour(Args(X, Y, Z), Kwargs("cmap"_a = cm::coolwarm)); #if USE_GUI plt.show(); #else diff --git a/gallery/mplot3d/errorbar3d.cpp b/gallery/mplot3d/errorbar3d.cpp index 283a0bb..eb58d23 100644 --- a/gallery/mplot3d/errorbar3d.cpp +++ b/gallery/mplot3d/errorbar3d.cpp @@ -1,6 +1,7 @@ // example from https://matplotlib.org/stable/gallery/mplot3d/errorbar3d.html #include +#include #include #include @@ -14,11 +15,13 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto ax = plt.figure().add_subplot(Args(), Kwargs("projection"_a = "3d")); - auto t_ = xt::arange(0.0, 2 * M_PI + 0.1, 0.01); - auto x_ = xt::sin(1.0 * t_); - auto y_ = xt::cos(3.0 * t_); - auto z_ = xt::sin(5.0 * t_); + const auto t_ = xt::arange(0.0, 2 * M_PI + 0.1, 0.01); + const auto x_ = xt::sin(1.0 * t_); + const auto y_ = xt::cos(3.0 * t_); + const auto z_ = xt::sin(5.0 * t_); vector t(t_.begin(), t_.end()), x(x_.begin(), x_.end()), y(y_.begin(), y_.end()), z(z_.begin(), z_.end()); diff --git a/gallery/mplot3d/lines3d.cpp b/gallery/mplot3d/lines3d.cpp index 186502f..4752efc 100644 --- a/gallery/mplot3d/lines3d.cpp +++ b/gallery/mplot3d/lines3d.cpp @@ -1,6 +1,7 @@ // example from https://matplotlib.org/stable/gallery/mplot3d/lines3d.html #include +#include #include #include @@ -13,17 +14,19 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto fig = plt.figure(); auto ax = fig.add_subplot(Args(), Kwargs("projection"_a = "3d")); - auto theta_ = xt::linspace(-4 * M_PI, 4 * M_PI, 100); - auto z_ = xt::linspace(-2.0, 2.0, 100); - auto r_ = 1.0 + xt::pow(z_, 2); - auto x_ = r_ * xt::sin(theta_); - auto y_ = r_ * xt::cos(theta_); - vector z(z_.begin(), z_.end()); - vector r(r_.begin(), r_.end()); - vector theta(theta_.begin(), theta_.end()); - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); + const auto theta_ = xt::linspace(-4 * M_PI, 4 * M_PI, 100); + const auto z_ = xt::linspace(-2.0, 2.0, 100); + const auto r_ = 1.0 + xt::pow(z_, 2); + const auto x_ = r_ * xt::sin(theta_); + const auto y_ = r_ * xt::cos(theta_); + const vector z(z_.begin(), z_.end()); + const vector r(r_.begin(), r_.end()); + const vector theta(theta_.begin(), theta_.end()); + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); ax.plot(Args(x, y, z), Kwargs("label"_a = "parametric curve")); ax.legend(); #if USE_GUI diff --git a/gallery/mplot3d/lorenz_attractor.cpp b/gallery/mplot3d/lorenz_attractor.cpp index 562b6ae..6588a19 100644 --- a/gallery/mplot3d/lorenz_attractor.cpp +++ b/gallery/mplot3d/lorenz_attractor.cpp @@ -2,6 +2,7 @@ // https://matplotlib.org/stable/gallery/mplot3d/lorenz_attractor.html #include +#include #include @@ -11,15 +12,17 @@ using namespace matplotlibcpp17; tuple lorenz(double x, double y, double z, double s = 10, double r = 28, double b = 2.667) { - double x_dot = s * (y - x); - double y_dot = r * x - y - x * z; - double z_dot = x * y - b * z; + const double x_dot = s * (y - x); + const double y_dot = r * x - y - x * z; + const double z_dot = x * y - b * z; return {x_dot, y_dot, z_dot}; } int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto fig = plt.figure(); auto ax = fig.add_subplot(Args(), Kwargs("projection"_a = "3d")); diff --git a/gallery/mplot3d/subplot3d.cpp b/gallery/mplot3d/subplot3d.cpp index 8f9f639..69f5ba9 100644 --- a/gallery/mplot3d/subplot3d.cpp +++ b/gallery/mplot3d/subplot3d.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -17,18 +18,19 @@ using mesh2D = vector>; // from mpl_toolkits.axes3d.py tuple get_test_data(double delta = 0.05) { - auto xs = xt::arange(-3.0, 3.0, delta); - auto ys = xt::arange(-3.0, 3.0, delta); - auto [X0, Y0] = xt::meshgrid(xs, ys); // 120x160 - auto Z1 = xt::exp(-(xt::pow(X0, 2) + xt::pow(Y0, 2)) / 2.0) / (2 * M_PI); - auto Z2 = + const auto xs = xt::arange(-3.0, 3.0, delta); + const auto ys = xt::arange(-3.0, 3.0, delta); + const auto [X0, Y0] = xt::meshgrid(xs, ys); // 120x160 + const auto Z1 = + xt::exp(-(xt::pow(X0, 2) + xt::pow(Y0, 2)) / 2.0) / (2 * M_PI); + const auto Z2 = xt::exp(-(xt::pow((X0 - 1.0) / 1.5, 2) + xt::pow((Y0 - 1.0) / 0.5, 2)) / 2) / (2 * M_PI * 0.5 * 1.5); - auto Z0 = Z2 - Z1; - auto X = X0 * 10; - auto Y = Y0 * 10; - auto Z = Z0 * 500; + const auto Z0 = Z2 - Z1; + const auto X = X0 * 10; + const auto Y = Y0 * 10; + const auto Z = Z0 * 500; const int szx = xs.shape()[0], szy = ys.shape()[0]; mesh2D X_(szx), Y_(szx), Z_(szx); for (int i = 0; i < szx; ++i) { @@ -47,14 +49,16 @@ tuple get_test_data(double delta = 0.05) { int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto [w, h] = plt.figaspect(Args(0.5)); auto fig = plt.figure(Args(), Kwargs("figsize"_a = py::make_tuple(w, h))); { auto ax = fig.add_subplot(Args(1, 2, 1), Kwargs("projection"_a = "3d")); - auto xs = xt::arange(-5.0, 5.0, 0.25); - auto [X0, Y0] = xt::meshgrid(xs, xs); - auto R0 = xt::sqrt(xt::pow(X0, 2) + xt::pow(Y0, 2)); - auto Z0 = xt::sin(R0); + const auto xs = xt::arange(-5.0, 5.0, 0.25); + const auto [X0, Y0] = xt::meshgrid(xs, xs); + const auto R0 = xt::sqrt(xt::pow(X0, 2) + xt::pow(Y0, 2)); + const auto Z0 = xt::sin(R0); // to vector const int sz = xs.shape()[0]; mesh2D X(sz), Y(sz), Z(sz); @@ -70,22 +74,23 @@ int main() { } // NOTE: conversion to numpy array // ref: https://github.com/pybind/pybind11/issues/2066 - auto X_ = py::array(py::cast(std::move(X))); - auto Y_ = py::array(py::cast(std::move(Y))); - auto Z_ = py::array(py::cast(std::move(Z))); + const auto X_ = py::array(py::cast(std::move(X))); + const auto Y_ = py::array(py::cast(std::move(Y))); + const auto Z_ = py::array(py::cast(std::move(Z))); auto surf = ax.plot_surface( Args(X_, Y_, Z_), Kwargs("rstride"_a = 1, "cstride"_a = 1, "linewidth"_a = 0, - "antialiased"_a = false, "cmap"_a = cm::coolwarm())); + "antialiased"_a = false, "cmap"_a = cm::coolwarm)); ax.set_zlim(Args(-1.01, 1.01)); - fig.colorbar(Args(surf), Kwargs("shrink"_a = 0.5, "aspect"_a = 10)); + fig.colorbar(Args(surf.unwrap()), + Kwargs("shrink"_a = 0.5, "aspect"_a = 10)); } { auto ax = fig.add_subplot(Args(1, 2, 2), Kwargs("projection"_a = "3d")); - auto [X, Y, Z] = get_test_data(0.05); - auto X_ = py::array(py::cast(std::move(X))); - auto Y_ = py::array(py::cast(std::move(Y))); - auto Z_ = py::array(py::cast(std::move(Z))); + const auto [X, Y, Z] = get_test_data(0.05); + const auto X_ = py::array(py::cast(std::move(X))); + const auto Y_ = py::array(py::cast(std::move(Y))); + const auto Z_ = py::array(py::cast(std::move(Z))); ax.plot_wireframe(Args(X_, Y_, Z_), Kwargs("rstride"_a = 10, "cstride"_a = 10)); } diff --git a/gallery/mplot3d/surface3d.cpp b/gallery/mplot3d/surface3d.cpp index c9defb5..488e5ec 100644 --- a/gallery/mplot3d/surface3d.cpp +++ b/gallery/mplot3d/surface3d.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -16,13 +17,15 @@ using mesh2D = vector>; int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); + // this is required for "projection = 3d" + matplotlibcpp17::mplot3d::import(); auto [fig, ax] = plt.subplots(Kwargs("subplot_kw"_a = py::dict("projection"_a = "3d"))); - auto xs = xt::arange(-5.0, 5.0, 0.25); - auto [X0, Y0] = xt::meshgrid(xs, xs); - auto R0 = xt::sqrt(xt::pow(X0, 2) + xt::pow(Y0, 2)); - auto Z0 = xt::sin(R0); + const auto xs = xt::arange(-5.0, 5.0, 0.25); + const auto [X0, Y0] = xt::meshgrid(xs, xs); + const auto R0 = xt::sqrt(xt::pow(X0, 2) + xt::pow(Y0, 2)); + const auto Z0 = xt::sin(R0); // to vector const int sz = xs.shape()[0]; mesh2D X(sz), Y(sz), Z(sz); @@ -37,18 +40,18 @@ int main() { } } // to numpy array (vector is converted to list of list) - auto X_ = py::array(py::cast(std::move(X))); - auto Y_ = py::array(py::cast(std::move(Y))); - auto Z_ = py::array(py::cast(std::move(Z))); - auto surf = ax.plot_surface(Args(X_, Y_, Z_), - Kwargs("rstride"_a = 1, "cstride"_a = 1, - "linewidth"_a = 0, "antialiased"_a = false, - "cmap"_a = cm::coolwarm())); + const auto X_ = py::array(py::cast(std::move(X))); + const auto Y_ = py::array(py::cast(std::move(Y))); + const auto Z_ = py::array(py::cast(std::move(Z))); + const auto surf = ax.plot_surface( + Args(X_, Y_, Z_), + Kwargs("rstride"_a = 1, "cstride"_a = 1, "linewidth"_a = 0, + "antialiased"_a = false, "cmap"_a = cm::coolwarm)); ax.set_zlim(Args(-1.01, 1.01)); // TODO // auto locator = ticker::LinearLocator(Args(10)); // ax.zaxis.set_major_locator(Args(locator.unwrap())); // ax.zaxis.set_major_formatter(Args("{x:.02f}")); - fig.colorbar(Args(surf), Kwargs("shrink"_a = 0.5, "aspect"_a = 5)); + fig.colorbar(Args(surf.unwrap()), Kwargs("shrink"_a = 0.5, "aspect"_a = 5)); plt.show(); } diff --git a/gallery/shapes_and_collections/patch_collection.cpp b/gallery/shapes_and_collections/patch_collection.cpp index ea5be4e..88183e5 100644 --- a/gallery/shapes_and_collections/patch_collection.cpp +++ b/gallery/shapes_and_collections/patch_collection.cpp @@ -17,7 +17,6 @@ int main() { auto plt = matplotlibcpp17::pyplot::import(); auto [fig, ax] = plt.subplots(); - const int resolution = 50; const int N = 3; xt::xarray x = xt::random::rand({N}); xt::xarray y = xt::random::rand({N}); @@ -32,8 +31,8 @@ int main() { x = xt::random::rand({N}); y = xt::random::rand({N}); radii = 0.1 * xt::random::rand({N}); - xt::xarray theta1 = 360.0 * xt::random::rand({N}); - xt::xarray theta2 = 360.0 * xt::random::rand({N}); + const xt::xarray theta1 = 360.0 * xt::random::rand({N}); + const xt::xarray theta2 = 360.0 * xt::random::rand({N}); for (int i = 0; i < N; ++i) { const double x1 = x[i], y1 = y[i], r = radii[i], th1 = theta1[i], th2 = theta2[i]; @@ -68,7 +67,7 @@ int main() { } auto colors__ = 100.0 * xt::random::rand({patches.size()}); - vector colors_(colors__.begin(), colors__.end()); + const vector colors_(colors__.begin(), colors__.end()); py::array colors = py::cast(colors_); auto p = collections::PatchCollection(Args(patches), Kwargs("alpha"_a = 0.4)); p.set_array(Args(colors)); diff --git a/gallery/statistics/errorbar.cpp b/gallery/statistics/errorbar.cpp index 5357a8f..3740b7e 100644 --- a/gallery/statistics/errorbar.cpp +++ b/gallery/statistics/errorbar.cpp @@ -12,9 +12,9 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = pyplot::import(); - auto x_ = xt::arange(0.1, 4.0, 0.5); - auto y_ = xt::exp(-x_); - vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); + const auto x_ = xt::arange(0.1, 4.0, 0.5); + const auto y_ = xt::exp(-x_); + const vector x(x_.begin(), x_.end()), y(y_.begin(), y_.end()); auto [fig, ax] = plt.subplots(); ax.errorbar(Args(x, y), Kwargs("xerr"_a = 0.2, "yerr"_a = 0.4)); diff --git a/gallery/statistics/hist.cpp b/gallery/statistics/hist.cpp index 70c790f..73e4f34 100644 --- a/gallery/statistics/hist.cpp +++ b/gallery/statistics/hist.cpp @@ -10,9 +10,9 @@ using namespace matplotlibcpp17; int main1() { int N_points = 100000; int n_bins = 20; - auto dist1_ = xt::random::randn({N_points}); - auto dist2_ = 0.4 * xt::random::randn({N_points}) + 5.0; - vector dist1(dist1_.begin(), dist1_.end()), + const auto dist1_ = xt::random::randn({N_points}); + const auto dist2_ = 0.4 * xt::random::randn({N_points}) + 5.0; + const vector dist1(dist1_.begin(), dist1_.end()), dist2(dist2_.begin(), dist2_.end()); auto plt = matplotlibcpp17::pyplot::import(); auto [fig, axs] = @@ -32,10 +32,10 @@ int main1() { // int main2() // pass int main3() { - int N_points = 100000; - auto dist1_ = xt::random::randn({N_points}); - auto dist2_ = 0.4 * xt::random::randn({N_points}) + 5.0; - vector dist1(dist1_.begin(), dist1_.end()), + const int N_points = 100000; + const auto dist1_ = xt::random::randn({N_points}); + const auto dist2_ = 0.4 * xt::random::randn({N_points}) + 5.0; + const vector dist1(dist1_.begin(), dist1_.end()), dist2(dist2_.begin(), dist2_.end()); auto plt = matplotlibcpp17::pyplot::import(); diff --git a/gallery/subplots_axes_and_figures/align_labels_demo.cpp b/gallery/subplots_axes_and_figures/align_labels_demo.cpp index ac14f54..d910371 100644 --- a/gallery/subplots_axes_and_figures/align_labels_demo.cpp +++ b/gallery/subplots_axes_and_figures/align_labels_demo.cpp @@ -18,16 +18,16 @@ int main() { auto gs = GridSpec(2, 2); // instead of gs[0, :] auto ax = fig.add_subplot(Args(gs(0, py::slice(0, 2, 1)).unwrap())); - auto tmp_ = xt::arange(0, 1000000, 10000); + const auto tmp_ = xt::arange(0, 1000000, 10000); vector tmp(tmp_.begin(), tmp_.end()); ax.plot(Args(tmp)); ax.set_ylabel(Args("YLabel0")); ax.set_xlabel(Args("XLabel0")); for (auto i : {0, 1}) { ax = fig.add_subplot(Args(gs(1, i).unwrap())); - auto ys_ = xt::arange(1.0, 0.0, -0.1); - auto xs_ = ys_ * 2000; - vector xs(xs_.begin(), xs_.end()), ys(ys_.begin(), ys_.end()); + const auto ys_ = xt::arange(1.0, 0.0, -0.1); + const auto xs_ = ys_ * 2000; + const vector xs(xs_.begin(), xs_.end()), ys(ys_.begin(), ys_.end()); ax.plot(Args(xs, ys)); ax.set_ylabel(Args(string("YLabel1 " + to_string(i)))); ax.set_xlabel(Args(string("XLabel1 " + to_string(i)))); diff --git a/gallery/subplots_axes_and_figures/colorbar_placement.cpp b/gallery/subplots_axes_and_figures/colorbar_placement.cpp index 9f1e341..a580d3f 100644 --- a/gallery/subplots_axes_and_figures/colorbar_placement.cpp +++ b/gallery/subplots_axes_and_figures/colorbar_placement.cpp @@ -16,7 +16,7 @@ int main1() { const vector cmaps = {"RdBu_r", "viridis"}; for (auto col : {0, 1}) { for (auto row : {0, 1}) { - auto x_ = xt::random::randn({20, 20}) * (col + 1.0); + const auto x_ = xt::random::randn({20, 20}) * (col + 1.0); vector> x(20); for (int i = 0; i < 20; ++i) { x[i].resize(20); diff --git a/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp b/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp index b40a8c0..8dc725f 100644 --- a/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp +++ b/gallery/subplots_axes_and_figures/multiple_figs_demo.cpp @@ -14,9 +14,9 @@ using namespace matplotlibcpp17; int main() { py::scoped_interpreter guard{}; auto plt = matplotlibcpp17::pyplot::import(); - auto x_ = xt::arange(0.0, 2.0, 0.01); - auto s1_ = xt::sin(2 * M_PI * x_); - auto s2_ = xt::sin(4 * M_PI * x_); + const auto x_ = xt::arange(0.0, 2.0, 0.01); + const auto s1_ = xt::sin(2 * M_PI * x_); + const auto s2_ = xt::sin(4 * M_PI * x_); vector x(x_.begin(), x_.end()), s1(s1_.begin(), s1_.end()), s2(s2_.begin(), s2_.end()); plt.figure(Args(1)); diff --git a/gallery/subplots_axes_and_figures/two_scales.cpp b/gallery/subplots_axes_and_figures/two_scales.cpp index b012b03..617a87d 100644 --- a/gallery/subplots_axes_and_figures/two_scales.cpp +++ b/gallery/subplots_axes_and_figures/two_scales.cpp @@ -13,10 +13,10 @@ using namespace matplotlibcpp17; int main() { auto t_ = xt::arange(0.01, 10.0, 0.01); - auto data1_ = xt::exp(t_); - auto data2_ = xt::sin(2 * M_PI * t_); - vector t(t_.begin(), t_.end()), data1(data1_.begin(), data1_.end()), - data2(data2_.begin(), data2_.end()); + const auto data1_ = xt::exp(t_); + const auto data2_ = xt::sin(2 * M_PI * t_); + const vector t(t_.begin(), t_.end()), + data1(data1_.begin(), data1_.end()), data2(data2_.begin(), data2_.end()); py::scoped_interpreter guard{}; auto plt = pyplot::import(); diff --git a/include/matplotlibcpp17/animation.h b/include/matplotlibcpp17/animation.h index 9c0424d..90b9ad4 100644 --- a/include/matplotlibcpp17/animation.h +++ b/include/matplotlibcpp17/animation.h @@ -24,8 +24,8 @@ struct DECL_STRUCT_ATTR ArtistAnimation : public BaseWrapper { load_attrs(); } // save - pybind11::object save(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper save(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); private: void load_attrs() { LOAD_FUNC_ATTR(save, self); } @@ -33,10 +33,10 @@ struct DECL_STRUCT_ATTR ArtistAnimation : public BaseWrapper { }; // save -pybind11::object ArtistAnimation::save(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper ArtistAnimation::save(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = save_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } } // namespace matplotlibcpp17::animation diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index 87f6983..f5bd394 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -31,72 +31,73 @@ using HistType = std::tuple, std::vector, **/ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { public: - Axes(pybind11::object axes) { + Axes(const pybind11::object &axes) { self = axes; load_attrs(); } + Axes(pybind11::object &&axes) { + self = std::move(axes); + load_attrs(); + } // add_artist - pybind11::object add_artist(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper add_artist(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // add_collection - pybind11::object - add_collection(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper add_collection(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // add_patch - pybind11::object add_patch(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper add_patch(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // axhline - pybind11::object axhline(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper axhline(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // bar container::BarContainer bar(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); // bar_label - pybind11::object bar_label(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper bar_label(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // barh container::BarContainer barh(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); // contour - pybind11::object contour(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper contour(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // contourf - pybind11::object contourf(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper contourf(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // errorbar - pybind11::object errorbar(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper errorbar(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // fill - pybind11::object fill(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper fill(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // fill_between - pybind11::object - fill_between(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper fill_between(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // fill_betweenx - pybind11::object - fill_betweenx(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper fill_betweenx(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // get_lines - pybind11::object get_lines(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper get_lines(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // get_xaxis_transform - pybind11::object + ObjectWrapper get_xaxis_transform(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -107,25 +108,24 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { std::vector get_xticklabels(); // grid - pybind11::object grid(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper grid(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // hist HistType hist(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); // hist2d - pybind11::object hist2d(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper hist2d(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // imshow - pybind11::object imshow(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper imshow(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // invert_yaxis - pybind11::object - invert_yaxis(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper invert_yaxis(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // legend legend::Legend legend(const pybind11::tuple &args = pybind11::tuple(), @@ -137,18 +137,16 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { const pybind11::dict &kwargs = pybind11::dict()); // plot - pybind11::object plot(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper plot(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // plot_surface - pybind11::object - plot_surface(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper plot_surface(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // plot_wireframe - pybind11::object - plot_wireframe(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper plot_wireframe(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // quiver quiver::Quiver quiver(const pybind11::tuple &args = pybind11::tuple(), @@ -164,74 +162,73 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { const pybind11::dict &kwargs = pybind11::dict()); // set - pybind11::object set(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_adjustable - pybind11::object - set_adjustable(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_adjustable(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_aspect - pybind11::object set_aspect(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_aspect(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_title - pybind11::object set_title(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_title(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_xlabel - pybind11::object set_xlabel(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_xlabel(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_xlim - pybind11::object set_xlim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_xlim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_xscale - pybind11::object set_xscale(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_xscale(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_xticks - pybind11::object set_xticks(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_xticks(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_xticklabels - pybind11::object + ObjectWrapper set_xticklabels(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); // set_ylabel - pybind11::object set_ylabel(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_ylabel(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_ylim - pybind11::object set_ylim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_ylim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_yscale - pybind11::object set_yscale(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_yscale(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_yticks - pybind11::object set_yticks(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_yticks(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_zlabel - pybind11::object set_zlabel(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_zlabel(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // set_zlim - pybind11::object set_zlim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_zlim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // text - pybind11::object text(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper text(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // tick_params - pybind11::object tick_params(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper tick_params(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // twinx Axes twinx(const pybind11::tuple &args = pybind11::tuple(), @@ -239,6 +236,18 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { private: void load_attrs() { + // NOTE: only when called with projection='3d', `plot_surface`, + // `plot_wireframe`, `set_zlabel` prop exists. + try { + 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 (...) { + projection_3d = false; + } LOAD_FUNC_ATTR(add_artist, self); LOAD_FUNC_ATTR(add_collection, self); LOAD_FUNC_ATTR(add_patch, self); @@ -268,18 +277,6 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { LOAD_FUNC_ATTR(legend, self); LOAD_FUNC_ATTR(pcolormesh, self); LOAD_FUNC_ATTR(plot, self); - // NOTE: only when called with projection='3d', `plot_surface`, - // `plot_wireframe`, `set_zlabel` prop exists. - try { - 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 (...) { - projection_3d = false; - } LOAD_FUNC_ATTR(quiver, self); LOAD_FUNC_ATTR(quiverkey, self); LOAD_FUNC_ATTR(scatter, self); @@ -348,35 +345,36 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { pybind11::object text_attr; pybind11::object tick_params_attr; pybind11::object twinx_attr; + // 3d bool projection_3d; }; // add_artist -pybind11::object Axes::add_artist(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::add_artist(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_artist_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // add_collection -pybind11::object Axes::add_collection(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::add_collection(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_collection_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // add_patch -pybind11::object Axes::add_patch(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::add_patch(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_patch_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // axhline -pybind11::object Axes::axhline(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::axhline(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = axhline_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // bar @@ -387,11 +385,11 @@ container::BarContainer Axes::bar(const pybind11::tuple &args, } // bar_label -pybind11::object Axes::bar_label(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::bar_label(const pybind11::tuple &args, + const pybind11::dict &kwargs) { #if MATPLOTLIB_MINOR_VER_GTE_4 pybind11::object ret = bar_label_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); #else ERROR_MSG( "Call to bar_label is invalid because matplotlib version is < 3.4.0"); @@ -407,22 +405,22 @@ container::BarContainer Axes::barh(const pybind11::tuple &args, } // contour -pybind11::object Axes::contour(const pybind11::tuple &args, - const pybind11::dict &kwargs) { - pybind11::object obj = contour_attr(*args, **kwargs); - return obj; +ObjectWrapper Axes::contour(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = contour_attr(*args, **kwargs); + return ObjectWrapper(std::move(ret)); } // contourf -pybind11::object Axes::contourf(const pybind11::tuple &args, - const pybind11::dict &kwargs) { - pybind11::object obj = contourf_attr(*args, **kwargs); - return obj; +ObjectWrapper Axes::contourf(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = contourf_attr(*args, **kwargs); + return ObjectWrapper(std::move(ret)); } // errorbar -pybind11::object Axes::errorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::errorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { if (projection_3d) { #if MATPLOTLIB_MINOR_VER_GTE_4 pybind11::object obj = errorbar_attr(*args, **kwargs); @@ -433,44 +431,44 @@ pybind11::object Axes::errorbar(const pybind11::tuple &args, std::exit(0); #endif } else { - pybind11::object obj = errorbar_attr(*args, **kwargs); - return obj; + pybind11::object ret = errorbar_attr(*args, **kwargs); + return ObjectWrapper(std::move(ret)); } } // fill -pybind11::object Axes::fill(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::fill(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // fill_between -pybind11::object Axes::fill_between(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::fill_between(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_between_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // fill_betweenx -pybind11::object Axes::fill_betweenx(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::fill_betweenx(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_betweenx_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // get_lines -pybind11::object Axes::get_lines(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::get_lines(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = get_lines_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // get_xaxis_transform -pybind11::object Axes::get_xaxis_transform(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::get_xaxis_transform(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = get_xaxis_transform_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // get_xlim @@ -492,10 +490,10 @@ std::vector Axes::get_xticklabels() { } // grid -pybind11::object Axes::grid(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::grid(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = grid_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // hist @@ -516,24 +514,24 @@ Axes::hist(const pybind11::tuple &args, const pybind11::dict &kwargs) { } // hist2d -pybind11::object Axes::hist2d(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::hist2d(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = hist2d_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // invert_yaxis -pybind11::object Axes::invert_yaxis(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::invert_yaxis(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = invert_yaxis_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // imshow -pybind11::object Axes::imshow(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = imshow_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // legend @@ -551,24 +549,24 @@ collections::QuadMesh Axes::pcolormesh(const pybind11::tuple &args, } // plot -pybind11::object Axes::plot(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::plot(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // plot_surface -pybind11::object Axes::plot_surface(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::plot_surface(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_surface_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // plot_wireframe -pybind11::object Axes::plot_wireframe(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::plot_wireframe(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_wireframe_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // quiver @@ -593,122 +591,122 @@ collections::PathCollection Axes::scatter(const pybind11::tuple &args, } // set -pybind11::object Axes::set(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_adjustable -pybind11::object Axes::set_adjustable(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_adjustable(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_adjustable_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_aspect -pybind11::object Axes::set_aspect(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_aspect(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_aspect_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_title -pybind11::object Axes::set_title(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_title(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_title_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_xlabel -pybind11::object Axes::set_xlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_xlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xlabel_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_xlim -pybind11::object Axes::set_xlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_xlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xlim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_xscale -pybind11::object Axes::set_xscale(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_xscale(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xscale_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_xticks -pybind11::object Axes::set_xticks(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_xticks(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xticks_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_xticklabels -pybind11::object Axes::set_xticklabels(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_xticklabels(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xticklabels_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_ylabel -pybind11::object Axes::set_ylabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_ylabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_ylabel_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_ylim -pybind11::object Axes::set_ylim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_ylim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_ylim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_yscale -pybind11::object Axes::set_yscale(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_yscale(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_yscale_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_yticks -pybind11::object Axes::set_yticks(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_yticks(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_yticks_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_zlabel -pybind11::object Axes::set_zlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_zlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_zlabel_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // set_zlim -pybind11::object Axes::set_zlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::set_zlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_zlim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // text -pybind11::object Axes::text(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::text(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = text_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // tick_params -pybind11::object Axes::tick_params(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Axes::tick_params(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = tick_params_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // twinx diff --git a/include/matplotlibcpp17/cm.h b/include/matplotlibcpp17/cm.h index 3d7383b..cc6869a 100644 --- a/include/matplotlibcpp17/cm.h +++ b/include/matplotlibcpp17/cm.h @@ -10,12 +10,7 @@ namespace matplotlibcpp17::cm { -pybind11::object coolwarm() { - pybind11::object ret = - pybind11::module::import("matplotlib.cm").attr("coolwarm"); - return ret; -} - +static const char *coolwarm = "coolwarm"; static const char *PuBu_r = "PuBu_r"; static const char *RdYlGn = "RdYlGn"; diff --git a/include/matplotlibcpp17/collections.h b/include/matplotlibcpp17/collections.h index e9de566..168f6b1 100644 --- a/include/matplotlibcpp17/collections.h +++ b/include/matplotlibcpp17/collections.h @@ -19,13 +19,17 @@ namespace matplotlibcpp17::collections { **/ struct DECL_STRUCT_ATTR PathCollection : public BaseWrapper { public: - PathCollection(pybind11::object pathcollection) { + PathCollection(const pybind11::object &pathcollection) { self = pathcollection; load_attrs(); } + PathCollection(pybind11::object &&pathcollection) { + self = std::move(pathcollection); + load_attrs(); + } // legend_elements - std::pair + std::pair legend_elements(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -37,13 +41,13 @@ struct DECL_STRUCT_ATTR PathCollection : public BaseWrapper { // legend_elements /// NOTE: this func does not return list of Line2Ds(handles) and list of /// strs(labels) unlike original python func -std::pair +std::pair PathCollection::legend_elements(const pybind11::tuple &args, const pybind11::dict &kwargs) { pybind11::list ret = legend_elements_attr(*args, **kwargs); pybind11::object handles = ret[0]; pybind11::object labels = ret[1]; - return {handles, labels}; + return {ObjectWrapper(std::move(handles)), ObjectWrapper(std::move(labels))}; } /** @@ -60,18 +64,18 @@ struct DECL_STRUCT_ATTR PatchCollection : public BaseWrapper { } // set_array - pybind11::object set_array(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_array(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); private: void load_attrs() { LOAD_FUNC_ATTR(set_array, self); } pybind11::object set_array_attr; }; -pybind11::object PatchCollection::set_array(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PatchCollection::set_array(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_array_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } /** @@ -79,7 +83,8 @@ pybind11::object PatchCollection::set_array(const pybind11::tuple &args, **/ struct DECL_STRUCT_ATTR QuadMesh : public BaseWrapper { public: - QuadMesh(pybind11::object quadmesh) { self = quadmesh; } + QuadMesh(const pybind11::object &quadmesh) { self = quadmesh; } + QuadMesh(pybind11::object &&quadmesh) { self = std::move(quadmesh); } }; } // namespace matplotlibcpp17::collections diff --git a/include/matplotlibcpp17/common.h b/include/matplotlibcpp17/common.h index a1029f7..0358397 100644 --- a/include/matplotlibcpp17/common.h +++ b/include/matplotlibcpp17/common.h @@ -9,6 +9,7 @@ #define DECL_STRUCT_ATTR __attribute__((visibility("hidden"))) #include +#include #define INFO_MSG(msg) \ do { \ @@ -37,12 +38,21 @@ namespace matplotlibcpp17 { **/ struct DECL_STRUCT_ATTR BaseWrapper { public: - pybind11::object unwrap() { return self; } + pybind11::object unwrap() const { return self; } protected: pybind11::object self; }; +/** + * @brief A proxy class for pybind object + **/ +struct ObjectWrapper : public BaseWrapper { +public: + ObjectWrapper(const pybind11::object &object) { self = object; } + ObjectWrapper(pybind11::object &&object) { self = std::move(object); } +}; + } // namespace matplotlibcpp17 #endif /* MATPLOTLIBCPP17_COMMON_H */ diff --git a/include/matplotlibcpp17/container.h b/include/matplotlibcpp17/container.h index a795365..70e2043 100644 --- a/include/matplotlibcpp17/container.h +++ b/include/matplotlibcpp17/container.h @@ -17,7 +17,10 @@ namespace matplotlibcpp17::container { **/ struct DECL_STRUCT_ATTR BarContainer : public BaseWrapper { public: - BarContainer(pybind11::object bar_container) { self = bar_container; } + BarContainer(const pybind11::object &bar_container) { self = bar_container; } + BarContainer(pybind11::object &&bar_container) { + self = std::move(bar_container); + } }; } // namespace matplotlibcpp17::container diff --git a/include/matplotlibcpp17/figure.h b/include/matplotlibcpp17/figure.h index 7135102..3d3aa3b 100644 --- a/include/matplotlibcpp17/figure.h +++ b/include/matplotlibcpp17/figure.h @@ -19,11 +19,14 @@ namespace matplotlibcpp17::figure { **/ struct DECL_STRUCT_ATTR Figure : public BaseWrapper { public: - Figure(pybind11::object figure) { + Figure(const pybind11::object &figure) { self = figure; load_attrs(); } - + Figure(pybind11::object &&figure) { + self = std::move(figure); + load_attrs(); + } // add_axes axes::Axes add_axes(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -38,26 +41,24 @@ struct DECL_STRUCT_ATTR Figure : public BaseWrapper { const pybind11::dict &kwargs = pybind11::dict()); // align_labels - pybind11::object - align_labels(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper align_labels(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // colorbar - pybind11::object colorbar(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper colorbar(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // savefig - pybind11::object savefig(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper savefig(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // suptitle - pybind11::object suptitle(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper suptitle(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // tight_layout - pybind11::object - tight_layout(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper tight_layout(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); private: void load_attrs() { @@ -101,38 +102,38 @@ axes::Axes Figure::add_subplot(const pybind11::tuple &args, } // align_labels -pybind11::object Figure::align_labels(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Figure::align_labels(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = align_labels_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // colorbar -pybind11::object Figure::colorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Figure::colorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = colorbar_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // savefig -pybind11::object Figure::savefig(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Figure::savefig(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = savefig_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // suptitle -pybind11::object Figure::suptitle(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Figure::suptitle(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = suptitle_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // tight_layout -pybind11::object Figure::tight_layout(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Figure::tight_layout(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = tight_layout_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } } // namespace matplotlibcpp17::figure diff --git a/include/matplotlibcpp17/gridspec.h b/include/matplotlibcpp17/gridspec.h index 3a9844a..24f450b 100644 --- a/include/matplotlibcpp17/gridspec.h +++ b/include/matplotlibcpp17/gridspec.h @@ -17,7 +17,8 @@ namespace matplotlibcpp17::gridspec { **/ struct DECL_STRUCT_ATTR SubplotSpec : public BaseWrapper { public: - SubplotSpec(pybind11::object subplotspec) { self = subplotspec; } + SubplotSpec(const pybind11::object &subplotspec) { self = subplotspec; } + SubplotSpec(pybind11::object &&subplotspec) { self = std::move(subplotspec); } }; /** @@ -36,7 +37,7 @@ struct DECL_STRUCT_ATTR GridSpec : public BaseWrapper { template SubplotSpec operator()(const Rows &r, const Cols &c) { pybind11::object obj = self[pybind11::make_tuple(r, c)]; - return SubplotSpec(obj); + return SubplotSpec(std::move(obj)); } private: diff --git a/include/matplotlibcpp17/legend.h b/include/matplotlibcpp17/legend.h index 6256a64..bf3b027 100644 --- a/include/matplotlibcpp17/legend.h +++ b/include/matplotlibcpp17/legend.h @@ -17,9 +17,8 @@ namespace matplotlibcpp17::legend { **/ struct DECL_STRUCT_ATTR Legend : public BaseWrapper { public: - Legend(pybind11::object obj) { - self = obj; - } + Legend(const pybind11::object &obj) { self = obj; } + Legend(pybind11::object &&obj) { self = std::move(obj); } }; } // namespace matplotlibcpp17::legend diff --git a/include/matplotlibcpp17/mplot3d.h b/include/matplotlibcpp17/mplot3d.h new file mode 100644 index 0000000..0aa922d --- /dev/null +++ b/include/matplotlibcpp17/mplot3d.h @@ -0,0 +1,18 @@ +/** + * @file mplot3d.h + * @brief header file for mplot3d + **/ + +#ifndef MATPLOTLIBCPP17_MPLOT3D_H +#define MATPLOTLIBCPP17_MPLOT3D_H + +#include + +namespace matplotlibcpp17::mplot3d { + +pybind11::object import() { + return pybind11::module::import("mpl_toolkits.mplot3d").attr("Axes3D"); +} + +} // namespace matplotlibcpp17::mplot3d +#endif diff --git a/include/matplotlibcpp17/pyplot.h b/include/matplotlibcpp17/pyplot.h index 7fa4ca0..71e69ff 100644 --- a/include/matplotlibcpp17/pyplot.h +++ b/include/matplotlibcpp17/pyplot.h @@ -33,28 +33,28 @@ struct DECL_STRUCT_ATTR PyPlot { axes::Axes axes(const pybind11::dict &kwargs = pybind11::dict()); // axis - pybind11::object axis(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper axis(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // cla - pybind11::object cla(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper cla(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // clf - pybind11::object clf(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper clf(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // clim - pybind11::object clim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper clim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // colorbar - pybind11::object colorbar(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper colorbar(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // errorbar - pybind11::object errorbar(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper errorbar(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // figaspect std::tuple @@ -74,48 +74,48 @@ struct DECL_STRUCT_ATTR PyPlot { const pybind11::dict &kwargs = pybind11::dict()); // gci - pybind11::object gci(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper gci(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // grid - pybind11::object grid(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper grid(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // imshow - pybind11::object imshow(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper imshow(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // legend - pybind11::object legend(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper legend(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // pause - pybind11::object pause(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper pause(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // plot - pybind11::object plot(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper plot(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // quiver - pybind11::object quiver(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper quiver(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // savefig - pybind11::object savefig(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper savefig(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // scatter - pybind11::object scatter(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper scatter(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // show - pybind11::object show(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper show(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // step - pybind11::object step(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper step(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // subplot axes::Axes subplot(const pybind11::dict &kwargs = pybind11::dict()); @@ -128,24 +128,24 @@ struct DECL_STRUCT_ATTR PyPlot { subplots(int r, int c, const pybind11::dict &kwargs = pybind11::dict()); // title - pybind11::object title(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper title(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // xlabel - pybind11::object xlabel(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper xlabel(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // xlim - pybind11::object xlim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper xlim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // ylabel - pybind11::object ylabel(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper ylabel(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // ylim - pybind11::object ylim(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper ylim(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); private: void load_attrs() { @@ -218,45 +218,45 @@ axes::Axes PyPlot::axes(const pybind11::dict &kwargs) { } // axis -pybind11::object PyPlot::axis(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::axis(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = axis_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // cla -pybind11::object PyPlot::cla(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::cla(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = cla_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // clf -pybind11::object PyPlot::clf(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::clf(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = clf_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // clim -pybind11::object PyPlot::clim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::clim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = clim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // colorbar -pybind11::object PyPlot::colorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::colorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = colorbar_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // errorbar -pybind11::object PyPlot::errorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::errorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = errorbar_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // figaspect @@ -290,80 +290,80 @@ figure::Figure PyPlot::gcf(const pybind11::tuple &args, } // gci -pybind11::object PyPlot::gci(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::gci(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = gci_attr(*args, **kwargs); return obj; } // grid -pybind11::object PyPlot::grid(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::grid(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = grid_attr(*args, **kwargs); return obj; } // imshow -pybind11::object PyPlot::imshow(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = imshow_attr(*args, **kwargs); return obj; } // legend -pybind11::object PyPlot::legend(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::legend(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = legend_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // pause -pybind11::object PyPlot::pause(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::pause(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = pause_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // plot -pybind11::object PyPlot::plot(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::plot(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // quiver -pybind11::object PyPlot::quiver(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::quiver(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = quiver_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // scatter -pybind11::object PyPlot::scatter(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::scatter(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = scatter_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // savefig -pybind11::object PyPlot::savefig(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::savefig(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = savefig_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // show -pybind11::object PyPlot::show(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::show(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = show_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // step -pybind11::object PyPlot::step(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::step(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = step_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // subplot @@ -416,38 +416,38 @@ PyPlot::subplots(int r, int c, const pybind11::dict &kwargs) { } // title -pybind11::object PyPlot::title(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::title(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = title_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // xlabel -pybind11::object PyPlot::xlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::xlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = xlabel_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // xlim -pybind11::object PyPlot::xlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::xlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = xlim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // ylabel -pybind11::object PyPlot::ylabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::ylabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = ylabel_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } // ylim -pybind11::object PyPlot::ylim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper PyPlot::ylim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = ylim_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } PyPlot import() { @@ -459,7 +459,7 @@ PyPlot import() { } // namespace matplotlibcpp17::pyplot // Args & Kwargs -template pybind11::tuple Args(ArgsT &&... args) { +template pybind11::tuple Args(ArgsT &&...args) { return pybind11::make_tuple(std::forward(args)...); } diff --git a/include/matplotlibcpp17/quiver.h b/include/matplotlibcpp17/quiver.h index 5ba4462..3c1a778 100644 --- a/include/matplotlibcpp17/quiver.h +++ b/include/matplotlibcpp17/quiver.h @@ -17,14 +17,16 @@ namespace matplotlibcpp17::quiver { **/ struct DECL_STRUCT_ATTR Quiver : public BaseWrapper { public: - Quiver(pybind11::object q) { self = q; } + Quiver(const pybind11::object &q) { self = q; } + Quiver(pybind11::object &&q) { self = std::move(q); } }; /** * @brief A wrapper class for matplotlib.quiver.QuiverKey **/ struct DECL_STRUCT_ATTR QuiverKey : public BaseWrapper { - QuiverKey(pybind11::object qk) { self = qk; } + QuiverKey(const pybind11::object &qk) { self = qk; } + QuiverKey(pybind11::object &&qk) { self = std::move(qk); } }; } // namespace matplotlibcpp17::quiver diff --git a/include/matplotlibcpp17/text.h b/include/matplotlibcpp17/text.h index 16ccec5..2834402 100644 --- a/include/matplotlibcpp17/text.h +++ b/include/matplotlibcpp17/text.h @@ -17,24 +17,27 @@ namespace matplotlibcpp17::text { struct DECL_STRUCT_ATTR Text : public BaseWrapper { public: - Text(pybind11::object text) { + Text(const pybind11::object &text) { self = text; load_attrs(); } + Text(pybind11::object &&text) { + self = std::move(text); + load_attrs(); + } - pybind11::object - set_rotation(const pybind11::tuple &args = pybind11::tuple(), - const pybind11::dict &kwargs = pybind11::dict()); + ObjectWrapper set_rotation(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); private: void load_attrs() { LOAD_FUNC_ATTR(set_rotation, self); } pybind11::object set_rotation_attr; }; -pybind11::object Text::set_rotation(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +ObjectWrapper Text::set_rotation(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_rotation_attr(*args, **kwargs); - return ret; + return ObjectWrapper(std::move(ret)); } } // namespace matplotlibcpp17::text From b49de375e694c2b9c2eba930f05dd7066697e12c Mon Sep 17 00:00:00 2001 From: soblin Date: Sun, 23 Oct 2022 08:28:47 +0900 Subject: [PATCH 07/10] updated README Signed-off-by: soblin --- README.md | 12 +++++++++++- include/matplotlibcpp17/cm.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9158045..51ca868 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ descibed in [minimal example](#minimal-example). ## Syntax -The user will need to capsulate *arguments* in `Args(arg1, arg2, ...) == pybind11:tuple` and *keyword arguments* in `Kwargs("k1"_a = v1, "k2"_a = v2, ...) == pybind11::dict`. The returned value is either a `pybind11::object` or a corresponding wrapper class. Please refer to the reference and examples below. +The user will need to capsulate *arguments* in `Args(arg1, arg2, ...) == pybind11:tuple` and *keyword arguments* in `Kwargs("k1"_a = v1, "k2"_a = v2, ...) == pybind11::dict`. The returned value is a wrapper class for pybind. Please refer to the reference and examples below. - exception: `subplots`, `TBD`s - conversion: Wrapper class of matplotlibcpp17 like [::container::BarContainer](https://github.com/soblin/matplotlibcpp17/blob/master/include/matplotlibcpp17/container.h) needs to be passed to python interpreter using `unwrap()` method in *args* and *kwargs*. @@ -180,6 +180,16 @@ From [gallery/images_contours_and_fields/quiver_demo.cpp](https://github.com/sob ![quiver_demo3](./gallery/images/quiver_demo_3.png) +### 3D + +To plot 3D graph with `projection = "3d"`, following code is required. + +```cpp +#include + +matplotlibcpp17::mplot3d::import(); +``` + ### gif Currently only `ArtistAnimation` is supported. `FuncAnimation` interface maybe implemented in the future. diff --git a/include/matplotlibcpp17/cm.h b/include/matplotlibcpp17/cm.h index cc6869a..c9da8ef 100644 --- a/include/matplotlibcpp17/cm.h +++ b/include/matplotlibcpp17/cm.h @@ -10,6 +10,7 @@ namespace matplotlibcpp17::cm { +// TODO: more colors static const char *coolwarm = "coolwarm"; static const char *PuBu_r = "PuBu_r"; static const char *RdYlGn = "RdYlGn"; From 0368a2410dd9c88d8bb023cdcb51f78f19adc757 Mon Sep 17 00:00:00 2001 From: Mamoru Sobue Date: Wed, 1 Mar 2023 01:29:39 +0900 Subject: [PATCH 08/10] added axes::cla (#29) Signed-off-by: soblin --- include/matplotlibcpp17/axes.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index f5bd394..80673b7 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -68,6 +68,10 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { container::BarContainer barh(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // cla + ObjectWrapper cla(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); + // contour ObjectWrapper contour(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); @@ -259,6 +263,7 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { WARN_MSG("Not loading bar_label because matplotlib version is < 3.4.0"); #endif LOAD_FUNC_ATTR(barh, self); + LOAD_FUNC_ATTR(cla, self); LOAD_FUNC_ATTR(contour, self); LOAD_FUNC_ATTR(contourf, self); LOAD_FUNC_ATTR(errorbar, self); @@ -304,6 +309,7 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { pybind11::object bar_attr; pybind11::object bar_label_attr; pybind11::object barh_attr; + pybind11::object cla_attr; pybind11::object contour_attr; pybind11::object contourf_attr; pybind11::object errorbar_attr; @@ -404,6 +410,13 @@ container::BarContainer Axes::barh(const pybind11::tuple &args, return container::BarContainer(obj); } +// cla +ObjectWrapper Axes::cla(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = cla_attr(*args, **kwargs); + return ObjectWrapper(std::move(ret)); +} + // contour ObjectWrapper Axes::contour(const pybind11::tuple &args, const pybind11::dict &kwargs) { From 779f108f192a27761cae3724929850fe65de625c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rnborg=20Nguyen?= Date: Wed, 14 Jun 2023 10:08:33 +0200 Subject: [PATCH 09/10] Added axvline (#31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added axvline * Added axvline Signed-off-by: Björnborg Nguyen --------- Signed-off-by: Björnborg Nguyen --- include/matplotlibcpp17/axes.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index 80673b7..95101f3 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -55,6 +55,9 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { // axhline ObjectWrapper axhline(const pybind11::tuple &args = pybind11::tuple(), const pybind11::dict &kwargs = pybind11::dict()); + // axvline + ObjectWrapper axvline(const pybind11::tuple &args = pybind11::tuple(), + const pybind11::dict &kwargs = pybind11::dict()); // bar container::BarContainer bar(const pybind11::tuple &args = pybind11::tuple(), @@ -256,6 +259,7 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { LOAD_FUNC_ATTR(add_collection, self); LOAD_FUNC_ATTR(add_patch, self); LOAD_FUNC_ATTR(axhline, self); + LOAD_FUNC_ATTR(axvline, self); LOAD_FUNC_ATTR(bar, self); #if MATPLOTLIB_MINOR_VER_GTE_4 LOAD_FUNC_ATTR(bar_label, self); @@ -306,6 +310,7 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { pybind11::object add_collection_attr; pybind11::object add_patch_attr; pybind11::object axhline_attr; + pybind11::object axvline_attr; pybind11::object bar_attr; pybind11::object bar_label_attr; pybind11::object barh_attr; @@ -383,6 +388,13 @@ ObjectWrapper Axes::axhline(const pybind11::tuple &args, return ObjectWrapper(std::move(ret)); } +// axvline +ObjectWrapper Axes::axvline(const pybind11::tuple &args, + const pybind11::dict &kwargs) { + pybind11::object ret = axvline_attr(*args, **kwargs); + return ObjectWrapper(std::move(ret)); +} + // bar container::BarContainer Axes::bar(const pybind11::tuple &args, const pybind11::dict &kwargs) { From 4d025b5975b701598fce8487cd8feaf82eb5923f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rnborg=20Nguyen?= Date: Mon, 23 Oct 2023 08:32:36 +0200 Subject: [PATCH 10/10] Replaced include guards with #pragma once (#32) Defined all functions with inline specifier to support multiple source files including this header only lib in same project --- include/matplotlibcpp17/animation.h | 6 +- include/matplotlibcpp17/axes.h | 204 +++++++++++++------------- include/matplotlibcpp17/cm.h | 6 +- include/matplotlibcpp17/collections.h | 12 +- include/matplotlibcpp17/common.h | 6 +- include/matplotlibcpp17/container.h | 6 +- include/matplotlibcpp17/figure.h | 40 +++-- include/matplotlibcpp17/gridspec.h | 6 +- include/matplotlibcpp17/legend.h | 6 +- include/matplotlibcpp17/mplot3d.h | 7 +- include/matplotlibcpp17/patches.h | 6 +- include/matplotlibcpp17/pyplot.h | 128 ++++++++-------- include/matplotlibcpp17/quiver.h | 6 +- include/matplotlibcpp17/text.h | 10 +- include/matplotlibcpp17/ticker.h | 6 +- 15 files changed, 200 insertions(+), 255 deletions(-) diff --git a/include/matplotlibcpp17/animation.h b/include/matplotlibcpp17/animation.h index 90b9ad4..18c557d 100644 --- a/include/matplotlibcpp17/animation.h +++ b/include/matplotlibcpp17/animation.h @@ -2,9 +2,7 @@ * @file animation.h * @brief corresponding header for matplotlib.animation **/ - -#ifndef MATPLOTLIBCPP17_ANIMATION_H -#define MATPLOTLIBCPP17_ANIMATION_H +#pragma once #include @@ -40,5 +38,3 @@ ObjectWrapper ArtistAnimation::save(const pybind11::tuple &args, } } // namespace matplotlibcpp17::animation - -#endif /* MATPLOTLIBCPP17_ANIMATION_H */ diff --git a/include/matplotlibcpp17/axes.h b/include/matplotlibcpp17/axes.h index 95101f3..07ecf3a 100644 --- a/include/matplotlibcpp17/axes.h +++ b/include/matplotlibcpp17/axes.h @@ -2,15 +2,13 @@ * @file axes.h * @brief corresponding header for matplotlib.axes **/ +#pragma once -#ifndef MATPLOTLIBCPP17_AXES_H -#define MATPLOTLIBCPP17_AXES_H - -#include #include +#include -#include #include +#include #include #include #include @@ -361,50 +359,50 @@ struct DECL_STRUCT_ATTR Axes : public BaseWrapper { }; // add_artist -ObjectWrapper Axes::add_artist(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::add_artist(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_artist_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // add_collection -ObjectWrapper Axes::add_collection(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::add_collection(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_collection_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // add_patch -ObjectWrapper Axes::add_patch(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::add_patch(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = add_patch_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // axhline -ObjectWrapper Axes::axhline(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::axhline(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = axhline_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // axvline -ObjectWrapper Axes::axvline(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::axvline(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = axvline_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // bar -container::BarContainer Axes::bar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline container::BarContainer Axes::bar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = bar_attr(*args, **kwargs); return container::BarContainer(obj); } // bar_label -ObjectWrapper Axes::bar_label(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::bar_label(const pybind11::tuple &args, + const pybind11::dict &kwargs) { #if MATPLOTLIB_MINOR_VER_GTE_4 pybind11::object ret = bar_label_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); @@ -416,36 +414,36 @@ ObjectWrapper Axes::bar_label(const pybind11::tuple &args, } // barh -container::BarContainer Axes::barh(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline container::BarContainer Axes::barh(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = barh_attr(*args, **kwargs); return container::BarContainer(obj); } // cla -ObjectWrapper Axes::cla(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::cla(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = cla_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // contour -ObjectWrapper Axes::contour(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::contour(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = contour_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // contourf -ObjectWrapper Axes::contourf(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::contourf(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = contourf_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // errorbar -ObjectWrapper Axes::errorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::errorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { if (projection_3d) { #if MATPLOTLIB_MINOR_VER_GTE_4 pybind11::object obj = errorbar_attr(*args, **kwargs); @@ -462,42 +460,42 @@ ObjectWrapper Axes::errorbar(const pybind11::tuple &args, } // fill -ObjectWrapper Axes::fill(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::fill(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // fill_between -ObjectWrapper Axes::fill_between(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::fill_between(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_between_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // fill_betweenx -ObjectWrapper Axes::fill_betweenx(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::fill_betweenx(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = fill_betweenx_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // get_lines -ObjectWrapper Axes::get_lines(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::get_lines(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = get_lines_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // get_xaxis_transform -ObjectWrapper Axes::get_xaxis_transform(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::get_xaxis_transform(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = get_xaxis_transform_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // get_xlim -std::tuple Axes::get_xlim() { +inline std::tuple Axes::get_xlim() { pybind11::list ret = get_xlim_attr(); double x1 = ret[0].cast(); double x2 = ret[1].cast(); @@ -505,7 +503,7 @@ std::tuple Axes::get_xlim() { } // get_xticklabels -std::vector Axes::get_xticklabels() { +inline std::vector Axes::get_xticklabels() { pybind11::list ret = get_xticklabels_attr(); std::vector texts; for (pybind11::size_t i = 0; i < ret.size(); ++i) { @@ -515,14 +513,15 @@ std::vector Axes::get_xticklabels() { } // grid -ObjectWrapper Axes::grid(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::grid(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = grid_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // hist -std::tuple, std::vector, container::BarContainer> +inline std::tuple, std::vector, + container::BarContainer> Axes::hist(const pybind11::tuple &args, const pybind11::dict &kwargs) { pybind11::list ret = hist_attr(*args, **kwargs); // parse N, bins, patches @@ -539,207 +538,206 @@ Axes::hist(const pybind11::tuple &args, const pybind11::dict &kwargs) { } // hist2d -ObjectWrapper Axes::hist2d(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::hist2d(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = hist2d_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // invert_yaxis -ObjectWrapper Axes::invert_yaxis(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::invert_yaxis(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = invert_yaxis_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // imshow -ObjectWrapper Axes::imshow(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = imshow_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // legend -legend::Legend Axes::legend(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline legend::Legend Axes::legend(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = legend_attr(*args, **kwargs); return legend::Legend(obj); } // pcolormesh -collections::QuadMesh Axes::pcolormesh(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline collections::QuadMesh Axes::pcolormesh(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = pcolormesh_attr(*args, **kwargs); return collections::QuadMesh(ret); } // plot -ObjectWrapper Axes::plot(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::plot(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // plot_surface -ObjectWrapper Axes::plot_surface(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::plot_surface(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_surface_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // plot_wireframe -ObjectWrapper Axes::plot_wireframe(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::plot_wireframe(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_wireframe_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // quiver -quiver::Quiver Axes::quiver(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline quiver::Quiver Axes::quiver(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = quiver_attr(*args, **kwargs); return quiver::Quiver(obj); } // quiverkey -quiver::QuiverKey Axes::quiverkey(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline quiver::QuiverKey Axes::quiverkey(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = quiverkey_attr(*args, **kwargs); return quiver::QuiverKey(obj); } // scatter -collections::PathCollection Axes::scatter(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline collections::PathCollection Axes::scatter(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = scatter_attr(*args, **kwargs); return collections::PathCollection(obj); } // set -ObjectWrapper Axes::set(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_adjustable -ObjectWrapper Axes::set_adjustable(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_adjustable(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_adjustable_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_aspect -ObjectWrapper Axes::set_aspect(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_aspect(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_aspect_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_title -ObjectWrapper Axes::set_title(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_title(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_title_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_xlabel -ObjectWrapper Axes::set_xlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_xlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xlabel_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_xlim -ObjectWrapper Axes::set_xlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_xlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xlim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_xscale -ObjectWrapper Axes::set_xscale(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_xscale(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xscale_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_xticks -ObjectWrapper Axes::set_xticks(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_xticks(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xticks_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_xticklabels -ObjectWrapper Axes::set_xticklabels(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_xticklabels(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_xticklabels_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_ylabel -ObjectWrapper Axes::set_ylabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_ylabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_ylabel_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_ylim -ObjectWrapper Axes::set_ylim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_ylim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_ylim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_yscale -ObjectWrapper Axes::set_yscale(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_yscale(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_yscale_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_yticks -ObjectWrapper Axes::set_yticks(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_yticks(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_yticks_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_zlabel -ObjectWrapper Axes::set_zlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_zlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_zlabel_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // set_zlim -ObjectWrapper Axes::set_zlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::set_zlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_zlim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // text -ObjectWrapper Axes::text(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::text(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = text_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // tick_params -ObjectWrapper Axes::tick_params(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Axes::tick_params(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = tick_params_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // twinx -Axes Axes::twinx(const pybind11::tuple &args, const pybind11::dict &kwargs) { +inline Axes Axes::twinx(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = twinx_attr(*args, **kwargs); return Axes(ret); } } // namespace matplotlibcpp17::axes - -#endif /* MATPLOTLIBCPP17_AXES_H */ diff --git a/include/matplotlibcpp17/cm.h b/include/matplotlibcpp17/cm.h index c9da8ef..8b66760 100644 --- a/include/matplotlibcpp17/cm.h +++ b/include/matplotlibcpp17/cm.h @@ -2,9 +2,7 @@ * @file cm.h * @brief corresponding header for matplotlib.cm **/ - -#ifndef MATPLOTLIBCPP17_CM_H -#define MATPLOTLIBCPP17_CM_H +#pragma once #include @@ -16,5 +14,3 @@ static const char *PuBu_r = "PuBu_r"; static const char *RdYlGn = "RdYlGn"; } // namespace matplotlibcpp17::cm - -#endif /* MATPLOTLIBCPP17_CM_H */ diff --git a/include/matplotlibcpp17/collections.h b/include/matplotlibcpp17/collections.h index 168f6b1..97762b6 100644 --- a/include/matplotlibcpp17/collections.h +++ b/include/matplotlibcpp17/collections.h @@ -2,9 +2,7 @@ * @file collections.h * @brief corresponding header for matplotlib.collections **/ - -#ifndef MATPLOTLIBCPP17_COLLECTIONS_H -#define MATPLOTLIBCPP17_COLLECTIONS_H +#pragma once #include @@ -41,7 +39,7 @@ struct DECL_STRUCT_ATTR PathCollection : public BaseWrapper { // legend_elements /// NOTE: this func does not return list of Line2Ds(handles) and list of /// strs(labels) unlike original python func -std::pair +inline std::pair PathCollection::legend_elements(const pybind11::tuple &args, const pybind11::dict &kwargs) { pybind11::list ret = legend_elements_attr(*args, **kwargs); @@ -72,8 +70,8 @@ struct DECL_STRUCT_ATTR PatchCollection : public BaseWrapper { pybind11::object set_array_attr; }; -ObjectWrapper PatchCollection::set_array(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PatchCollection::set_array(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_array_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } @@ -88,5 +86,3 @@ struct DECL_STRUCT_ATTR QuadMesh : public BaseWrapper { }; } // namespace matplotlibcpp17::collections - -#endif /* MATPLOTLIBCPP17_COLLECTIONS_H */ diff --git a/include/matplotlibcpp17/common.h b/include/matplotlibcpp17/common.h index 0358397..e39c1c4 100644 --- a/include/matplotlibcpp17/common.h +++ b/include/matplotlibcpp17/common.h @@ -1,5 +1,5 @@ -#ifndef MATPLOTLIBCPP17_COMMON_H -#define MATPLOTLIBCPP17_COMMON_H +#pragma once + #define LOAD_FUNC_ATTR(obj, mod) \ do { \ @@ -54,5 +54,3 @@ struct ObjectWrapper : public BaseWrapper { }; } // namespace matplotlibcpp17 - -#endif /* MATPLOTLIBCPP17_COMMON_H */ diff --git a/include/matplotlibcpp17/container.h b/include/matplotlibcpp17/container.h index 70e2043..41f817b 100644 --- a/include/matplotlibcpp17/container.h +++ b/include/matplotlibcpp17/container.h @@ -2,9 +2,7 @@ * @file container.h * @brief corresponding header for matplotlib.axes **/ - -#ifndef MATPLOTLIBCPP17_CONTAINER_H -#define MATPLOTLIBCPP17_CONTAINER_H +#pragma once #include @@ -24,5 +22,3 @@ struct DECL_STRUCT_ATTR BarContainer : public BaseWrapper { }; } // namespace matplotlibcpp17::container - -#endif /* MATPLOTLIBCPP17_CONTAINER_H */ diff --git a/include/matplotlibcpp17/figure.h b/include/matplotlibcpp17/figure.h index 3d3aa3b..e0c422d 100644 --- a/include/matplotlibcpp17/figure.h +++ b/include/matplotlibcpp17/figure.h @@ -2,12 +2,10 @@ * @file figure.h * @brief corresponding header for matplotlib.figure **/ +#pragma once -#ifndef MATPLOTLIBCPP17_FIGURE_H -#define MATPLOTLIBCPP17_FIGURE_H - -#include #include +#include #include #include @@ -82,60 +80,58 @@ struct DECL_STRUCT_ATTR Figure : public BaseWrapper { }; // add_axes -axes::Axes Figure::add_axes(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline axes::Axes Figure::add_axes(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = add_axes_attr(*args, **kwargs); return axes::Axes(obj); } // add_gridspec -gridspec::GridSpec Figure::add_gridspec(int nrow, int ncol, - const pybind11::dict &kwargs) { +inline gridspec::GridSpec Figure::add_gridspec(int nrow, int ncol, + const pybind11::dict &kwargs) { return gridspec::GridSpec(nrow, ncol, kwargs); } // add_subplot -axes::Axes Figure::add_subplot(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline axes::Axes Figure::add_subplot(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = add_subplot_attr(*args, **kwargs); return axes::Axes(obj); } // align_labels -ObjectWrapper Figure::align_labels(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Figure::align_labels(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = align_labels_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // colorbar -ObjectWrapper Figure::colorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Figure::colorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = colorbar_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // savefig -ObjectWrapper Figure::savefig(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Figure::savefig(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = savefig_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // suptitle -ObjectWrapper Figure::suptitle(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Figure::suptitle(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = suptitle_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // tight_layout -ObjectWrapper Figure::tight_layout(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Figure::tight_layout(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = tight_layout_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } } // namespace matplotlibcpp17::figure - -#endif /* MATPLOTLIBCPP17_FIGURE_H */ diff --git a/include/matplotlibcpp17/gridspec.h b/include/matplotlibcpp17/gridspec.h index 24f450b..2bef269 100644 --- a/include/matplotlibcpp17/gridspec.h +++ b/include/matplotlibcpp17/gridspec.h @@ -2,9 +2,7 @@ * @file gridspec.h * @brief corresponding header for matplotlib.axes **/ - -#ifndef MATPLOTLIBCPP17_GRIDSPEC_H -#define MATPLOTLIBCPP17_GRIDSPEC_H +#pragma once #include @@ -46,5 +44,3 @@ struct DECL_STRUCT_ATTR GridSpec : public BaseWrapper { }; } // namespace matplotlibcpp17::gridspec - -#endif /* MATPLOTLIBCPP17_GRIDSPEC_H */ diff --git a/include/matplotlibcpp17/legend.h b/include/matplotlibcpp17/legend.h index bf3b027..9076fa0 100644 --- a/include/matplotlibcpp17/legend.h +++ b/include/matplotlibcpp17/legend.h @@ -2,9 +2,7 @@ * @file legend.h * @brief corresponding header for matplotlib.legend **/ - -#ifndef MATPLOTLIBCPP17_LEGEND_H -#define MATPLOTLIBCPP17_LEGEND_H +#pragma once #include @@ -22,5 +20,3 @@ struct DECL_STRUCT_ATTR Legend : public BaseWrapper { }; } // namespace matplotlibcpp17::legend - -#endif /* MATPLOTLIBCPP17_LEGEND_H */ diff --git a/include/matplotlibcpp17/mplot3d.h b/include/matplotlibcpp17/mplot3d.h index 0aa922d..f7d1f12 100644 --- a/include/matplotlibcpp17/mplot3d.h +++ b/include/matplotlibcpp17/mplot3d.h @@ -2,9 +2,7 @@ * @file mplot3d.h * @brief header file for mplot3d **/ - -#ifndef MATPLOTLIBCPP17_MPLOT3D_H -#define MATPLOTLIBCPP17_MPLOT3D_H +#pragma once #include @@ -14,5 +12,4 @@ pybind11::object import() { return pybind11::module::import("mpl_toolkits.mplot3d").attr("Axes3D"); } -} // namespace matplotlibcpp17::mplot3d -#endif +} // namespace matplotlibcpp17::mplot3d \ No newline at end of file diff --git a/include/matplotlibcpp17/patches.h b/include/matplotlibcpp17/patches.h index 83ac366..e3e838f 100644 --- a/include/matplotlibcpp17/patches.h +++ b/include/matplotlibcpp17/patches.h @@ -2,9 +2,7 @@ * @file pathces.h * @brief corresponding header for matplotlib.patches **/ - -#ifndef MATPLOTLIBCPP17_PATCHES_H -#define MATPLOTLIBCPP17_PATCHES_H +#pragma once #include @@ -91,5 +89,3 @@ struct DECL_STRUCT_ATTR Polygon : public BaseWrapper { }; } // namespace matplotlibcpp17::patches - -#endif /* MATPLOTLIBCPP17_PATCHES_H */ diff --git a/include/matplotlibcpp17/pyplot.h b/include/matplotlibcpp17/pyplot.h index 71e69ff..a3e1455 100644 --- a/include/matplotlibcpp17/pyplot.h +++ b/include/matplotlibcpp17/pyplot.h @@ -2,20 +2,18 @@ * @file pyplot.h * @brief corresponding header for matplotlib.pyplot **/ - -#ifndef MATPLOTLIBCPP17_PYPLOT_H -#define MATPLOTLIBCPP17_PYPLOT_H +#pragma once #include -#include #include +#include #include -#include #include -#include #include +#include +#include namespace matplotlibcpp17::pyplot { @@ -212,56 +210,56 @@ struct DECL_STRUCT_ATTR PyPlot { }; // axes -axes::Axes PyPlot::axes(const pybind11::dict &kwargs) { +inline axes::Axes PyPlot::axes(const pybind11::dict &kwargs) { pybind11::object ax_obj = axes_attr(**kwargs); return axes::Axes(ax_obj); } // axis -ObjectWrapper PyPlot::axis(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::axis(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = axis_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // cla -ObjectWrapper PyPlot::cla(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::cla(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = cla_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // clf -ObjectWrapper PyPlot::clf(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::clf(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = clf_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // clim -ObjectWrapper PyPlot::clim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::clim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = clim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // colorbar -ObjectWrapper PyPlot::colorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::colorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = colorbar_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // errorbar -ObjectWrapper PyPlot::errorbar(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::errorbar(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = errorbar_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // figaspect -std::tuple PyPlot::figaspect(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline std::tuple +PyPlot::figaspect(const pybind11::tuple &args, const pybind11::dict &kwargs) { pybind11::list l = figaspect_attr(*args, **kwargs); double width = l[0].cast(); double height = l[1].cast(); @@ -269,115 +267,115 @@ std::tuple PyPlot::figaspect(const pybind11::tuple &args, } // figure -figure::Figure PyPlot::figure(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline figure::Figure PyPlot::figure(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object fig_obj = figure_attr(*args, **kwargs); return figure::Figure(fig_obj); } // gca -axes::Axes PyPlot::gca(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline axes::Axes PyPlot::gca(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = gca_attr(*args, **kwargs); return axes::Axes(obj); } // gcf -figure::Figure PyPlot::gcf(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline figure::Figure PyPlot::gcf(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = gcf_attr(*args, **kwargs); return figure::Figure(obj); } // gci -ObjectWrapper PyPlot::gci(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::gci(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = gci_attr(*args, **kwargs); return obj; } // grid -ObjectWrapper PyPlot::grid(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::grid(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = grid_attr(*args, **kwargs); return obj; } // imshow -ObjectWrapper PyPlot::imshow(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::imshow(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object obj = imshow_attr(*args, **kwargs); return obj; } // legend -ObjectWrapper PyPlot::legend(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::legend(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = legend_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // pause -ObjectWrapper PyPlot::pause(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::pause(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = pause_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // plot -ObjectWrapper PyPlot::plot(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::plot(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = plot_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // quiver -ObjectWrapper PyPlot::quiver(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::quiver(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = quiver_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // scatter -ObjectWrapper PyPlot::scatter(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::scatter(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = scatter_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // savefig -ObjectWrapper PyPlot::savefig(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::savefig(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = savefig_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // show -ObjectWrapper PyPlot::show(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::show(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = show_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // step -ObjectWrapper PyPlot::step(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::step(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = step_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // subplot -axes::Axes PyPlot::subplot(const pybind11::dict &kwargs) { +inline axes::Axes PyPlot::subplot(const pybind11::dict &kwargs) { return axes::Axes(subplot_attr(**kwargs)); } -axes::Axes PyPlot::subplot(int cri) { +inline axes::Axes PyPlot::subplot(int cri) { pybind11::object obj = subplot_attr(cri); return axes::Axes(obj); } // subplots -std::tuple +inline std::tuple PyPlot::subplots(const pybind11::dict &kwargs) { pybind11::list ret = subplots_attr(**kwargs); pybind11::object fig = ret[0]; @@ -385,7 +383,7 @@ PyPlot::subplots(const pybind11::dict &kwargs) { return {figure::Figure(fig), axes::Axes(ax)}; } -std::tuple> +inline std::tuple> PyPlot::subplots(int r, int c, const pybind11::dict &kwargs) { // subplots() returns [][] (if r > 1 && c > 1) else [] // return []axes in row-major @@ -416,41 +414,41 @@ PyPlot::subplots(int r, int c, const pybind11::dict &kwargs) { } // title -ObjectWrapper PyPlot::title(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::title(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = title_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // xlabel -ObjectWrapper PyPlot::xlabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::xlabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = xlabel_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // xlim -ObjectWrapper PyPlot::xlim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::xlim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = xlim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // ylabel -ObjectWrapper PyPlot::ylabel(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::ylabel(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = ylabel_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } // ylim -ObjectWrapper PyPlot::ylim(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper PyPlot::ylim(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = ylim_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } -PyPlot import() { +inline PyPlot import() { auto mod = pybind11::module::import("matplotlib.pyplot"); auto g_pyplot = PyPlot(mod); return g_pyplot; @@ -468,5 +466,3 @@ using Kwargs = pybind11::dict; // Export this namespace py = pybind11; using namespace py::literals; - -#endif /* MATPLOTLIBCPP17_PYPLOT_H */ diff --git a/include/matplotlibcpp17/quiver.h b/include/matplotlibcpp17/quiver.h index 3c1a778..caab9cd 100644 --- a/include/matplotlibcpp17/quiver.h +++ b/include/matplotlibcpp17/quiver.h @@ -2,9 +2,7 @@ * @file quiver.h * @brief corresponding header for matplotlib.quiver **/ - -#ifndef MATPLOTLIBCPP17_QUIVER_H -#define MATPLOTLIBCPP17_QUIVER_H +#pragma once #include @@ -30,5 +28,3 @@ struct DECL_STRUCT_ATTR QuiverKey : public BaseWrapper { }; } // namespace matplotlibcpp17::quiver - -#endif /* MATPLOTLIBCPP17_QUIVER_H */ diff --git a/include/matplotlibcpp17/text.h b/include/matplotlibcpp17/text.h index 2834402..b8d002b 100644 --- a/include/matplotlibcpp17/text.h +++ b/include/matplotlibcpp17/text.h @@ -2,9 +2,7 @@ * @file text.h * @brief corresponding header for matplotlib.text **/ - -#ifndef MATPLOTLIBCPP17_TEXT_H -#define MATPLOTLIBCPP17_TEXT_H +#pragma once #include @@ -34,12 +32,10 @@ struct DECL_STRUCT_ATTR Text : public BaseWrapper { pybind11::object set_rotation_attr; }; -ObjectWrapper Text::set_rotation(const pybind11::tuple &args, - const pybind11::dict &kwargs) { +inline ObjectWrapper Text::set_rotation(const pybind11::tuple &args, + const pybind11::dict &kwargs) { pybind11::object ret = set_rotation_attr(*args, **kwargs); return ObjectWrapper(std::move(ret)); } } // namespace matplotlibcpp17::text - -#endif /* MATPLOTLIBCPP17_TEXT_H */ diff --git a/include/matplotlibcpp17/ticker.h b/include/matplotlibcpp17/ticker.h index 7051ccd..b9d024e 100644 --- a/include/matplotlibcpp17/ticker.h +++ b/include/matplotlibcpp17/ticker.h @@ -2,9 +2,7 @@ * @file ticker.h * @brief corresponding header for matplotlib.ticker **/ - -#ifndef MATPLOTLIBCPP17_TICKER_H -#define MATPLOTLIBCPP17_TICKER_H +#pragma once #include @@ -22,5 +20,3 @@ struct DECL_STRUCT_ATTR LogLocator : public BaseWrapper { }; } // namespace matplotlibcpp17::ticker - -#endif /* MATPLOTLIBCPP17_ANIMATION_H */