block by timelyportfolio 7a39d6593b9e6c470ff3

svg responsiveness with waffle in R

Full Screen

Interactive and Responsive waffles

Just some experiments with the R package waffle from @hrbrmstr. I like things that are responsive and interactive.

library(waffle)
library(extrafont)
library(gridSVG)
library(XML)
library(htmltools)
library(pipeR)

# slightly more complex example
parts <- c(`Un-breached\nUS Population`=(318-11-79), `Premera`=11, `Anthem`=79)
library(extrafont)
waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda"),
       use_glyph="medkit", size=8)

grid.export(name=NULL) %>>%
  (.$svg) %>>%
  (~{xmlAttrs(.)["width"]="100%"} ) %>>%
  (~{xmlAttrs(.)["height"]="100%"} ) %>>%
  saveXML %>>%
  HTML %>>%
  html_print

code.R