From 89d02b1d673452ef8e347b0aaa8620aa66ddf8f6 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Tue, 6 Aug 2019 15:02:04 +0200 Subject: [PATCH 1/2] allow plotly plotting in ijulia --- src/backends/plotly.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index b9c6c7cf..ae109ab8 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -822,8 +822,6 @@ function html_head(plt::Plot{PlotlyBackend}) """) ijulia_initialized[] = true end - # IJulia just needs one initialization - isijulia() && return "" return "" end @@ -863,6 +861,11 @@ function _show(io::IO, ::MIME"application/vnd.plotly.v1+json", plot::Plot{Plotly end +function _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend}) + write(io, standalone_html(plt)) +end + + function _display(plt::Plot{PlotlyBackend}) standalone_html_window(plt) end From 9228c0b9ec66f2895ec7cc30e44a38b76938b251 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Tue, 6 Aug 2019 16:08:49 +0200 Subject: [PATCH 2/2] improve plotly html formatting --- src/backends/plotly.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index ae109ab8..007c3d05 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -347,7 +347,7 @@ function plotly_layout(plt::Plot) end function plotly_layout_json(plt::Plot) - JSON.json(plotly_layout(plt)) + JSON.json(plotly_layout(plt), 4) end @@ -800,7 +800,7 @@ function plotly_series(plt::Plot) end # get json string for a list of dictionaries, each representing the series params -plotly_series_json(plt::Plot) = JSON.json(plotly_series(plt)) +plotly_series_json(plt::Plot) = JSON.json(plotly_series(plt), 4) # ----------------------------------------------------------------