Skip to content

Instantly share code, notes, and snippets.

@gireeshkbogu
Last active January 22, 2016 10:52
Show Gist options
  • Save gireeshkbogu/c068b5e8b9f6079d83eb to your computer and use it in GitHub Desktop.
Save gireeshkbogu/c068b5e8b9f6079d83eb to your computer and use it in GitHub Desktop.
require(ggplot2)
require(reshape2)
mtcars2 = melt(mtcars, id.vars='mpg')
ggplot(mtcars2) +
geom_jitter(aes(value,mpg, colour=variable),) + geom_smooth(aes(value,mpg, colour=variable), method=lm, se=FALSE) +
facet_wrap(~variable, scales="free_x") +
labs(x = "Percentage cover (%)", y = "Number of individuals (N)")
# useful links:
# http://stackoverflow.com/questions/25752909/multiple-ggplot-linear-regression-lines
@gireeshkbogu
Copy link
Author

linear regression

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