Skip to content

Instantly share code, notes, and snippets.

@sebastianbarfort
Last active August 29, 2015 14:07
Show Gist options
  • Save sebastianbarfort/872b963d84bbbfee1c41 to your computer and use it in GitHub Desktop.
Save sebastianbarfort/872b963d84bbbfee1c41 to your computer and use it in GitHub Desktop.
can you do this in ggvis?
library(ggplot2)
hec <- as.data.frame(xtabs(Freq ~ Hair + Eye, HairEyeColor))
hec$ind = ifelse(hec$Hair == "Blond", 1, 0)
ggplot(hec[1:4, ], aes(x = Hair, y = Freq, fill = factor(ind))) +
geom_bar(stat = "identity",
position = "dodge")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment