diff --git a/src/Plots.jl b/src/Plots.jl index e02cc169..f6e4b19f 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -293,18 +293,4 @@ end const CURRENT_BACKEND = CurrentBackend(:none) -# for compatibility with Requires.jl: -@init begin - if isdefined(Main, :PLOTS_DEFAULTS) - if haskey(Main.PLOTS_DEFAULTS, :theme) - theme(Main.PLOTS_DEFAULTS[:theme]) - end - for (k,v) in Main.PLOTS_DEFAULTS - k == :theme || default(k, v) - end - end -end - -# --------------------------------------------------------- - end # module diff --git a/src/init.jl b/src/init.jl index 26a28191..34fa035b 100644 --- a/src/init.jl +++ b/src/init.jl @@ -1,4 +1,21 @@ function __init__() + if isdefined(Main, :PLOTS_DEFAULTS) + if haskey(Main.PLOTS_DEFAULTS, :theme) + theme(Main.PLOTS_DEFAULTS[:theme]) + end + for (k,v) in Main.PLOTS_DEFAULTS + k == :theme || default(k, v) + end + end + pushdisplay(PlotsDisplay()) + + atreplinit(i -> begin + if PlotDisplay() in Base.Multimedia.displays + popdisplay(PlotsDisplay()) + end + pushdisplay(PlotsDisplay()) + end) + include(joinpath(@__DIR__, "backends", "plotly.jl")) include(joinpath(@__DIR__, "backends", "gr.jl")) include(joinpath(@__DIR__, "backends", "web.jl")) diff --git a/src/output.jl b/src/output.jl index 8f1df0a3..16494fda 100644 --- a/src/output.jl +++ b/src/output.jl @@ -145,11 +145,6 @@ function Base.display(::PlotsDisplay, plt::Plot) _display(plt) end -# override the REPL display to open a gui window -using REPL -Base.display(::REPL.REPLDisplay, ::MIME"text/plain", plt::Plot) = gui(plt) - - _do_plot_show(plt, showval::Bool) = showval && gui(plt) function _do_plot_show(plt, showval::Symbol) showval == :gui && gui(plt)