From 49aee2d204817315f13ee7f2db39cd879f98d6e7 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 5 Apr 2022 15:02:56 +0200 Subject: [PATCH] Update unicodeplots.jl --- src/backends/unicodeplots.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 7afa3156..d8aa204a 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -251,6 +251,7 @@ end # ------------------------------------------------------------------------------------------ function _show(io::IO, ::MIME"image/png", plt::Plot{UnicodePlotsBackend}) + prepare_output(plt) nr, nc = size(plt.layout) s1 = zeros(Int, nr, nc) s2 = zeros(Int, nr, nc) @@ -294,13 +295,11 @@ function _show(io::IO, ::MIME"image/png", plt::Plot{UnicodePlotsBackend}) end Base.show(plt::Plot{UnicodePlotsBackend}) = show(stdout, plt) -function Base.show(io::IO, plt::Plot{UnicodePlotsBackend}) - prepare_output(plt) - _show(io, MIME("text/plain"), plt) -end +Base.show(io::IO, plt::Plot{UnicodePlotsBackend}) = _show(io, MIME("text/plain"), plt) # NOTE: _show(...) must be kept for Base.showable (src/output.jl) function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend}) + prepare_output(plt) nr, nc = size(plt.layout) if nr == 1 && nc == 1 # fast path n = length(plt.o)