Skip to content

Instantly share code, notes, and snippets.

@kohske
Created June 21, 2017 02:57
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/8a4dfcd417c64d2e8b46ba41f6c2fa23 to your computer and use it in GitHub Desktop.
Save kohske/8a4dfcd417c64d2e8b46ba41f6c2fa23 to your computer and use it in GitHub Desktop.
ggplot2 group interaction
library(ggplot2)
d = data.frame(expand.grid(x=1:10, g=factor(1:2)), y=rnorm(2*10))
ggplot(d, aes(x=x, y=y, colour=g, group=interaction(x<5, g))) + geom_line() + geom_point()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment