From 1da4b2eda94df96f5d8f7e7d39ad36363635e475 Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Mon, 16 Sep 2019 13:07:08 +0200 Subject: [PATCH 1/2] allow html output in Juno e.g. for the PlotlyJS backend --- src/output.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/output.jl b/src/output.jl index bbc7b80e..aa5f89a3 100644 --- a/src/output.jl +++ b/src/output.jl @@ -201,6 +201,8 @@ for mime in ("text/plain", "text/html", "image/png", "image/eps", "image/svg+xml end end +Base.show(io::IO, m::MIME"application/prs.juno.plotpane+html", plt::Plot) = showjuno(io, MIME("text/html"), plt) + # default text/plain for all backends _show(io::IO, ::MIME{Symbol("text/plain")}, plt::Plot) = show(io, plt) @@ -229,7 +231,7 @@ closeall() = closeall(backend()) # Atom PlotPane # --------------------------------------------------------- function showjuno(io::IO, m, plt) - sz = plt[:size] + sz = collect(plt[:size]) dpi = plt[:dpi] thickness_scaling = plt[:thickness_scaling] @@ -258,4 +260,8 @@ function _showjuno(io::IO, m::MIME"image/svg+xml", plt) end end +function Base.showable(m::MIME"application/prs.juno.plotpane+html", plt::P) where P <: Plot + return showable(MIME("text/html"), plt) +end + _showjuno(io::IO, m, plt) = _show(io, m, plt) From 871561afd7fb4509bd15533707fcf5640431ba2e Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Mon, 16 Sep 2019 13:09:01 +0200 Subject: [PATCH 2/2] prettier function definition --- src/output.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/output.jl b/src/output.jl index aa5f89a3..9fe661f4 100644 --- a/src/output.jl +++ b/src/output.jl @@ -260,8 +260,6 @@ function _showjuno(io::IO, m::MIME"image/svg+xml", plt) end end -function Base.showable(m::MIME"application/prs.juno.plotpane+html", plt::P) where P <: Plot - return showable(MIME("text/html"), plt) -end +Base.showable(::MIME"application/prs.juno.plotpane+html", plt::Plot) = showable(MIME"text/html"(), plt) _showjuno(io::IO, m, plt) = _show(io, m, plt)