Skip to content
Snippets Groups Projects
Commit cac40010 authored by soblin's avatar soblin
Browse files

migrated .cpp in shapes_and_collections

parent d2cac9d2
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ if(${ADD_DEMO})
# add_subdirectory(gallery/subplots_axes_and_figures)
# add_subdirectory(gallery/statistics)
add_subdirectory(gallery/images_contours_and_fields)
# add_subdirectory(gallery/shapes_and_collections)
add_subdirectory(gallery/shapes_and_collections)
add_subdirectory(gallery/artist_animation)
endif()
......
......
......@@ -59,13 +59,13 @@ int main() {
py::list colors = py::cast(colors_);
auto p =
collections::PatchCollection(args_(patches), kwargs_("alpha"_a = 0.4));
p.set_array(colors);
ax.add_collection(p.unwrap());
fig.colorbar(p.unwrap(), "ax"_a = ax.unwrap());
p.set_array(args_(colors));
ax.add_collection(args_(p.unwrap()));
fig.colorbar(args_(p.unwrap()), kwargs_("ax"_a = ax.unwrap()));
#if USE_GUI
plt.show();
#else
plt.savefig("patch_collection.png");
plt.savefig(args_("patch_collection.png"));
#endif
return 0;
}
......@@ -26,14 +26,14 @@ int main() {
kwargs_("fc"_a = "b", "ec"_a = "y"));
auto r = Rectangle(args_(py::make_tuple(0, 0), 0.25, 0.5),
kwargs_("ec"_a = "#000000", "fill"_a = false));
ax.add_patch(c.unwrap());
ax.add_patch(e.unwrap());
ax.add_patch(r.unwrap());
plt.axis("scaled");
ax.set_aspect("equal");
ax.add_patch(args_(c.unwrap()));
ax.add_patch(args_(e.unwrap()));
ax.add_patch(args_(r.unwrap()));
plt.axis(args_("scaled"));
ax.set_aspect(args_("equal"));
#if USE_GUI
plt.show();
#else
plt.savefig("patches_circle_rectangle.png");
plt.savefig(args_("patches_circle_rectangle.png"));
#endif
}
......@@ -19,7 +19,7 @@ public:
load_attrs();
}
// axes
axes::Axes axes(const pybind11::dict &kwargs);
axes::Axes axes(const pybind11::dict &kwargs = pybind11::dict());
// axis
pybind11::object axis(const pybind11::tuple &args = pybind11::tuple(),
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment