diff --git a/include/matplotlibcpp17/pyplot.h b/include/matplotlibcpp17/pyplot.h index c62c1aed710b076c0cbef7d681f795e5767169a5..8ffb3587867a6e7ef7cee5de8e94cf49f8a95cba 100644 --- a/include/matplotlibcpp17/pyplot.h +++ b/include/matplotlibcpp17/pyplot.h @@ -456,6 +456,16 @@ ObjectWrapper PyPlot::ylim(const pybind11::tuple &args, return ObjectWrapper(std::move(ret)); } +PyPlot nonInteractiveImport(){ + auto mod = pybind11::module::import("matplotlib.pyplot"); + auto g_pyplot = PyPlot(mod); + auto abb = pybind11::module::import("matplotlib"); + // use the agg backend + abb.attr("use")("Agg"); + return g_pyplot; +} + + PyPlot import() { auto mod = pybind11::module::import("matplotlib.pyplot"); auto g_pyplot = PyPlot(mod);