Created
September 7, 2015 14:06
-
-
Save mortenpi/cc7ad2c8792ed3e52de4 to your computer and use it in GitHub Desktop.
Makes the plots in Gadfly non-interactive (Juno lags with interactive plots)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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