Skip to content

Instantly share code, notes, and snippets.

@baptiste
Last active November 29, 2017 19:53
Show Gist options
  • Save baptiste/a6dbce4a4a64540752c68bee3660f4aa to your computer and use it in GitHub Desktop.
Save baptiste/a6dbce4a4a64540752c68bee3660f4aa to your computer and use it in GitHub Desktop.
library(grImport2)
library(grConvert)
library(egg)
convertPicture("noun_3663.svg", "balloon.svg")
balloon <- readPicture("balloon.svg")
d <- data.frame(x=1:9, y=rnorm(9),
data = I(Map(function(c, s) list(c=c,s=s),c=blues9,s=1:9)),
stringsAsFactors = F)
balloonGrob <- function(data,x=0.5,y=0.5){
grob(x=x,y=y,data=data, cl="balloon")
}
drawDetails.balloon <- function(x, recording=FALSE){
grid.picture(x$x,x$y, picture = balloon, width = unit(x$data$s,"mm"),
gpFUN= function(gp)modifyList(gp, list(fill=x$data$c)))
}
ggplot(d, aes(x,y))+
geom_custom(aes(data = data), grob_fun = balloonGrob)
@baptiste
Copy link
Author

baptiste commented Nov 29, 2017

screen shot 2017-11-29 at 10 12 26 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment