From 80c8b8fe64c4ca6b4fe500bc445a5abcecf0b426 Mon Sep 17 00:00:00 2001 From: Ben Arthur Date: Thu, 13 Sep 2018 07:15:44 -0400 Subject: [PATCH] fix support for Juno --- src/Gadfly.jl | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Gadfly.jl b/src/Gadfly.jl index 2cebdda34..48bf415b9 100755 --- a/src/Gadfly.jl +++ b/src/Gadfly.jl @@ -53,7 +53,7 @@ function __init__() show(err) end else - push_theme(Juno.isactive() ? :dark : :default) + push_theme(:default) end end @@ -950,6 +950,14 @@ function show(io::IO, m::MIME"image/svg+xml", p::Plot) show(io, m, svg) end +function show(io::IO, m::MIME"application/juno+plotpane", p::Plot) + buf = IOBuffer() + svg = SVGJS(buf, Compose.default_graphic_width, + Compose.default_graphic_height, false) + draw(svg, p) + show(io, "text/html", svg) +end + try getfield(Compose, :Cairo) # throws if Cairo isn't being used global show @@ -1090,22 +1098,6 @@ function display(d::REPLDisplay, ::MIME"application/pdf", p::Union{Plot,Compose. open_file(filename) end -# Display in Juno - -import Juno: Juno, @render, media, Media - -media(Plot, Media.Plot) - -@render Juno.PlotPane p::Plot begin - x, y = Juno.plotsize() - set_default_plot_size(x*Gadfly.px, y*Gadfly.px) - HTML(stringmime("text/html", p)) -end - -@render Juno.Editor p::Gadfly.Plot begin - Juno.icon("graph") -end - include("coord.jl") include("geometry.jl") include("guide.jl")