make UnicodePlots print to the given io

and add support for text/plain in Plots own display_dict
fix #1514
This commit is contained in:
Fredrik Ekre 2018-06-04 12:34:14 +02:00
parent 69a7a8a04e
commit 32ec9e82bf
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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