diff --git a/src/display.jl b/src/display.jl index 90d63462..016fae43 100644 --- a/src/display.jl +++ b/src/display.jl @@ -133,7 +133,12 @@ include("displays/electron.jl") include("displays/ijulia.jl") # default to electron display (will get over-written when Requires.jl picks up IJulia code) -SyncPlot(p::Plot) = SyncPlot(p, ElectronDisplay(p)) +const DEFAULT_DISPLAY = Ref{Type{<:AbstractPlotlyDisplay}}(ElectronDisplay) + +function set_display!(x::Type{T}) where T <: AbstractPlotlyDisplay + DEFAULT_DISPLAY[] = x +end +SyncPlot(p::Plot) = SyncPlot(p, DEFAULT_DISPLAY[](p)) # methods to convert from one frontend to another let diff --git a/src/displays/ijulia.jl b/src/displays/ijulia.jl index 5ff08931..683de21e 100644 --- a/src/displays/ijulia.jl +++ b/src/displays/ijulia.jl @@ -183,8 +183,7 @@ prependtraces!(jd::JupyterDisplay, update::Associative=Dict(), "application/vnd.plotly.v1+json" => JSON.lower(p)) end end - - SyncPlot(p::Plot) = SyncPlot(p, JupyterDisplay(p)) + set_display!(JupyterDisplay) IJulia.display_dict(p::Plot) = Dict("text/plain" => sprint(show, "text/plain", p))