From ac73798b9d4801f08ef93e4f7fc9e92ad69db865 Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Thu, 16 Aug 2018 11:59:56 +0200 Subject: [PATCH 1/3] actually use PlotsDisplay() instead of overloading display for REPLDisplay --- src/Plots.jl | 1 + src/output.jl | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Plots.jl b/src/Plots.jl index 854b13bf..ac99a187 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -304,6 +304,7 @@ const CURRENT_BACKEND = CurrentBackend(:none) k == :theme || default(k, v) end end + pushdisplay(PlotsDisplay()) end # --------------------------------------------------------- diff --git a/src/output.jl b/src/output.jl index 7c762d6b..dbee501b 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) From 6593e3cfe6d1f99b2404524c7d86dce260671d2a Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Thu, 16 Aug 2018 12:23:23 +0200 Subject: [PATCH 2/3] actually use __init__ --- src/Plots.jl | 15 --------------- src/init.jl | 10 ++++++++++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Plots.jl b/src/Plots.jl index ac99a187..d63282f9 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -294,19 +294,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 - pushdisplay(PlotsDisplay()) -end - -# --------------------------------------------------------- - end # module diff --git a/src/init.jl b/src/init.jl index 53f5898b..51865535 100644 --- a/src/init.jl +++ b/src/init.jl @@ -1,4 +1,14 @@ 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()) + include(joinpath(@__DIR__, "backends", "plotly.jl")) include(joinpath(@__DIR__, "backends", "gr.jl")) include(joinpath(@__DIR__, "backends", "web.jl")) From 00be8a223790cc54cfb8f3cedadc911e75da857b Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Thu, 16 Aug 2018 12:34:33 +0200 Subject: [PATCH 3/3] make sure display order is correct if Plots is loaded before the REPL --- src/init.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/init.jl b/src/init.jl index 51865535..9cf52741 100644 --- a/src/init.jl +++ b/src/init.jl @@ -9,6 +9,13 @@ function __init__() 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"))