Skip to content

Instantly share code, notes, and snippets.

@mortenpi
Created September 7, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenpi/cc7ad2c8792ed3e52de4 to your computer and use it in GitHub Desktop.
Save mortenpi/cc7ad2c8792ed3e52de4 to your computer and use it in GitHub Desktop.
Makes the plots in Gadfly non-interactive (Juno lags with interactive plots)
module NoninteractiveGadfly
import Compose
import Compose: writemime
import Gadfly
export @noninteractive
type NoninteractivePlot
p::Gadfly.Plot
end
function writemime(io::IO, m::MIME"text/html", p::NoninteractivePlot)
buf = IOBuffer()
svg = Gadfly.SVG(buf, Compose.default_graphic_width,
Compose.default_graphic_height, false)
Gadfly.draw(svg, p.p)
writemime(io, m, svg)
end
macro noninteractive(plot)
:( NoninteractivePlot($(esc(plot))) )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment