From 5e5f23b5e5776266566bb95955ed00643dae3b3c Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Fri, 16 Jun 2017 15:26:30 +0200 Subject: [PATCH] fix world age error --- src/backends.jl | 6 +++--- src/output.jl | 16 +++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 19a9c6ea..9248d05b 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -135,7 +135,7 @@ function pickDefaultBackend() Pkg.installed(env_default) # this will error if not installed sym = Symbol(lowercase(env_default)) if haskey(_backendType, sym) - return backend(sym) + return @eval backend($sym) else warn("You have set PLOTS_DEFAULT_BACKEND=$env_default but it is not a valid backend package. Choose from:\n\t", join(sort(_backends), "\n\t")) @@ -150,12 +150,12 @@ function pickDefaultBackend() # features, speed, and robustness for pkgstr in ("GR", "PyPlot", "PlotlyJS", "PGFPlots", "UnicodePlots", "InspectDR", "GLVisualize") if Pkg.installed(pkgstr) != nothing - return backend(Symbol(lowercase(pkgstr))) + return @eval backend(Symbol(lowercase($pkgstr))) end end # the default if nothing else is installed - backend(:plotly) + @eval backend(:plotly) end diff --git a/src/output.jl b/src/output.jl index bd444ba0..a838a542 100644 --- a/src/output.jl +++ b/src/output.jl @@ -283,22 +283,20 @@ using Requires import Hiccup, Media Media.media(Plot, Media.Plot) - # default text/plain so it doesn't complain - function Base.show{B}(io::IO, ::MIME"text/plain", plt::Plot{B}) - print(io, "Plot{$B}()") - end - function Juno.render(e::Juno.Editor, plt::Plot) Juno.render(e, nothing) end if get(ENV, "PLOTS_USE_ATOM_PLOTPANE", true) in (true, 1, "1", "true", "yes") - # this is like "display"... sends an html div with the plot to the PlotPane function Juno.render(pane::Juno.PlotPane, plt::Plot) # temporarily overwrite size to be Atom.plotsize sz = plt[:size] + jsize = Juno.plotsize() + jsize[1] == 0 && (jsize[1] = 400) + jsize[2] == 0 && (jsize[2] = 500) + plt[:size] = Juno.plotsize() - Juno.render(pane, Hiccup.div(".fill", HTML(stringmime(MIME("text/html"), plt)))) + Juno.render(pane, HTML(stringmime(MIME("text/html"), plt))) plt[:size] = sz end # special handling for PlotlyJS @@ -309,7 +307,7 @@ using Requires function Juno.render(pane::Juno.PlotPane, plt::Plot) display(Plots.PlotsDisplay(), plt) s = "PlotPane turned off. Unset ENV[\"PLOTS_USE_ATOM_PLOTPANE\"] and restart Julia to enable it." - Juno.render(pane, Hiccup.div(HTML(s))) + Juno.render(pane, HTML(s)) end end @@ -317,6 +315,6 @@ using Requires function Juno.render(pane::Juno.PlotPane, plt::Plot{PlotlyBackend}) display(Plots.PlotsDisplay(), plt) s = "PlotPane turned off. The plotly backend cannot render in the PlotPane due to javascript issues. Plotlyjs is similar to plotly and is compatible with the plot pane." - Juno.render(pane, Hiccup.div(HTML(s))) + Juno.render(pane, HTML(s)) end end