From 7fb995094e73d23cefcd4ddf081ae6f333361c54 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Wed, 12 Oct 2016 11:28:43 -0400 Subject: [PATCH] added closeall for gr/pyplot --- src/Plots.jl | 1 + src/backends/gr.jl | 2 ++ src/backends/pyplot.jl | 2 ++ src/output.jl | 2 ++ 4 files changed, 7 insertions(+) diff --git a/src/Plots.jl b/src/Plots.jl index eebe49b8..b5f09597 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -67,6 +67,7 @@ export savefig, png, gui, + closeall, backend, backends, diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 7a12bae7..c3573614 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1079,3 +1079,5 @@ function _display(plt::Plot{GRBackend}) gr_display(plt) end end + +closeall(::GRBackend) = GR.emergencyclosegks() diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index eb0ce0ad..abac4017 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1224,3 +1224,5 @@ for (mime, fmt) in _pyplot_mimeformats ) end end + +closeall(::PyPlotBackend) = PyPlot.plt[:close]("all") diff --git a/src/output.jl b/src/output.jl index b71dc7ed..d2b7da7c 100644 --- a/src/output.jl +++ b/src/output.jl @@ -172,6 +172,8 @@ for mime in keys(_mimeformats) end end +closeall() = closeall(backend()) + # --------------------------------------------------------- # A backup, if no PNG generation is defined, is to try to make a PDF and use FileIO to convert