From b9d586c00969ade23157e72f87678b9eca258bcd Mon Sep 17 00:00:00 2001 From: piever Date: Sat, 24 Feb 2018 01:35:30 +0000 Subject: [PATCH 1/2] make plotlyjs use html in ijulia --- src/output.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/output.jl b/src/output.jl index c06e0be9..48380006 100644 --- a/src/output.jl +++ b/src/output.jl @@ -171,7 +171,8 @@ const _mimeformats = Dict( const _best_html_output_type = KW( :pyplot => :png, :unicodeplots => :txt, - :glvisualize => :png + :glvisualize => :png, + :plotlyjs => :html ) # a backup for html... passes to svg or png depending on the html_output_format arg @@ -270,6 +271,9 @@ end elseif output_type == :svg mime = "image/svg+xml" Dict{String,String}(mime => sprint(show, MIME(mime), plt)) + elseif output_type == :html + mime = "text/html" + Dict{String,String}(mime => sprint(show, MIME(mime), plt)) else error("Unsupported output type $output_type") end From ef48b66ac4d0705f4f13e23e5d4e8f26904a50b9 Mon Sep 17 00:00:00 2001 From: piever Date: Sat, 24 Feb 2018 01:55:59 +0000 Subject: [PATCH 2/2] fix plotly --- src/backends/plotly.jl | 5 +++++ src/output.jl | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 0330e149..34d43b9e 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -794,6 +794,11 @@ function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyBackend}) write(io, html_head(plt) * html_body(plt)) end +function Base.show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend}) + prepare_output(plt) + write(io, html_head(plt) * html_body(plt)) +end + function _display(plt::Plot{PlotlyBackend}) standalone_html_window(plt) end diff --git a/src/output.jl b/src/output.jl index 48380006..99a55d50 100644 --- a/src/output.jl +++ b/src/output.jl @@ -172,7 +172,8 @@ const _best_html_output_type = KW( :pyplot => :png, :unicodeplots => :txt, :glvisualize => :png, - :plotlyjs => :html + :plotlyjs => :html, + :plotly => :html ) # a backup for html... passes to svg or png depending on the html_output_format arg