Skip to content

Instantly share code, notes, and snippets.

@kohske
Created June 20, 2017 09:58
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 kohske/277a47d5f031057e7e0a249413f853b4 to your computer and use it in GitHub Desktop.
Save kohske/277a47d5f031057e7e0a249413f853b4 to your computer and use it in GitHub Desktop.
ggplot2 group inspection
library(ggplot2)
d = data.frame(expand.grid(x=letters[1:4], g=factor(1:2)), y=rnorm(8))
p = ggplot(d, aes(x=x, y=y, colour=as.numeric(g))) + geom_line() + geom_point()
g = ggplot_build(p)
g$data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment