stat_QQnorm | R Documentation |
Quantile-Quantile Plots with ggplot2
stat_QQnorm(mapping = NULL, data = NULL, geom = "point", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
mapping |
Set of aesthetic mappings created by aes or aes_. |
data |
The data to be displayed in this layer. |
geom |
Use to override the default geom |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. |
show.legend |
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. |
inherit.aes |
If FALSE, overrides the default aesthetics, rather than combining with them. |
... |
other arguments passed on to layer. |
Provide normal QQplot
geom_smooth understands the following aesthetics (required aesthetics are in bold):
x, alpha, colour, fill, group, shape, size, stroke
dd<-data.frame(gr=c(rep("A",20),rep("B",40))) dd$dv<-2*(dd$gr=="B")+rnorm(nrow(dd))/(1+2*(dd$gr=="A")) dd<-dd[order(dd$gr,dd$dv),] dd$px<-NA for(gri in levels(dd$gr)){ dd$px[dd$gr==gri]<-qqnorm(dd$dv[dd$gr==gri],plot=FALSE)$x } ggplot(dd, aes(dv)) + stat_QQnorm()+ facet_wrap(~gr) ## Not run: ggplot(dd, aes(dv,color=factor(gr))) + stat_QQnorm() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.