Skip to content

Commit

Permalink
fix support for Juno
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Sep 13, 2018
1 parent 58794f5 commit 80c8b8f
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/Gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function __init__()
show(err)
end
else
push_theme(Juno.isactive() ? :dark : :default)
push_theme(:default)
end
end

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 80c8b8f

Please sign in to comment.