Skip to content

Instantly share code, notes, and snippets.

@smithdanielle
Last active January 13, 2016 13:46
Show Gist options
  • Save smithdanielle/ce45415a9edf83bc8c19 to your computer and use it in GitHub Desktop.
Save smithdanielle/ce45415a9edf83bc8c19 to your computer and use it in GitHub Desktop.
Example of qqplots in ggplot2
occlusion2.data$qqplot.comparison.resid <- ddply(.data = occlusion2.data$qqplot.comparison, .variables = .(condition, transformed), function(dat){
q <- qqnorm(dat$threshold, plot = FALSE)
dat$xq <- q$x
dat
}
)
occlusion2.qqplot <- ggplot(data = occlusion2.data$qqplot.comparison.resid, aes(x = xq, y = threshold)) +
geom_smooth(method = "lm", se = FALSE, size = 1) +
geom_point() +
xlab("theoretical quantiles") +
ylab("sample quantiles") +
facet_grid(transformed ~ condition, scales = "free") +
theme_bw(base_size = 14)+
theme(legend.position="none",
panel.background = element_blank(),
axis.title.y = element_text(vjust=1.5),
axis.title.x = element_text(vjust=0),
strip.background = element_rect(fill = "black", color = "black"),
strip.text = element_text(face = "bold", colour = "white"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment