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

changed color name in cm to a static const char


Signed-off-by: default avatarsoblin <hilo.soblin@gmail.com>
parent b51db019
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......@@ -2,6 +2,7 @@
// https://matplotlib.org/stable/gallery/images_contours_and_fields/image_demo.html
#include <matplotlibcpp17/pyplot.h>
#include <matplotlibcpp17/cm.h>
#include <xtensor/xbuilder.hpp>
#include <xtensor/xview.hpp>
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment