Skip to content

Instantly share code, notes, and snippets.

@ggada
Created February 13, 2017 19:37
Show Gist options
  • Save ggada/ab29de2d5cba462add0dfff209b97433 to your computer and use it in GitHub Desktop.
Save ggada/ab29de2d5cba462add0dfff209b97433 to your computer and use it in GitHub Desktop.
Linear regression line - ggplot2
ggplot(height, aes(x=fheight, y=sheight)) +
geom_point(size=0.2) +
stat_smooth(method = lm) +
xlab("Father's height") +
ylab("Son's height") +
ggtitle("Son's height vs. Father's height") +
theme(plot.title = element_text(hjust = 0.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment