From 32ec9e82bf5273bde184b7f7ca0c2a05330f2dbe Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Mon, 4 Jun 2018 12:34:14 +0200 Subject: [PATCH] make UnicodePlots print to the given io and add support for text/plain in Plots own display_dict fix #1514 --- src/backends/unicodeplots.jl | 2 +- src/output.jl | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 6b4e124d..f644966d 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -212,7 +212,7 @@ end function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend}) unicodeplots_rebuild(plt) - map(show, plt.o) + foreach(x -> show(io, x), plt.o) nothing end diff --git a/src/output.jl b/src/output.jl index a839464c..cebfe920 100644 --- a/src/output.jl +++ b/src/output.jl @@ -284,7 +284,10 @@ end output_type = get(_best_html_output_type, backend_name(plt.backend), :svg) end out = Dict() - if output_type == :png + if output_type == :txt + mime = "text/plain" + out[mime] = sprint(show, MIME(mime), plt) + elseif output_type == :png mime = "image/png" out[mime] = base64encode(show, MIME(mime), plt) elseif output_type == :svg