stat_qq {ggplot2}R Documentation

stat\_qq

Description

Calculation for quantile-quantile plot

Usage

stat_qq(mapping = NULL, data = NULL, geom = "point", position = "identity", 
    distribution = qnorm, dparams = list(), na.rm = FALSE, ...)

Arguments

mapping

mapping between variables and aesthetics generated by aes

data

dataset used in this layer, if not specified uses plot dataset

geom

geometric used by this layer

position

position adjustment used by this layer

distribution

NULL

dparams

Parameters for distribution function

na.rm

NULL

...

Other arguments passed to distribution function

Details

This page describes stat\_qq, see layer and qplot for how to create a complete plot from individual components.

Value

A layer

Aesthetics

The following aesthetics can be used with stat\_qq. Aesthetics are mapped to variables in the data with the aes function: stat\_qq(aes(x = var))

Author(s)

Hadley Wickham, http://had.co.nz/

See Also

Examples

## Not run: 
# From ?qqplot
y <- rt(200, df = 5)
qplot(sample = y, stat="qq")

# qplot is smart enough to use stat_qq if you use sample
qplot(sample = y)
qplot(sample = precip)

qplot(sample = y, dist = qt, dparams = list(df = 5))

df <- data.frame(y)
ggplot(df, aes(sample = y)) + stat_qq()
ggplot(df, aes(sample = y)) + geom_point(stat = "qq")

# Use fitdistr from MASS to estimate distribution params
params <- as.list(MASS::fitdistr(y, "t")$estimate)
ggplot(df, aes(sample = y)) + stat_qq(dist = qt, dparam = params)

# Using to explore the distribution of a variable
qplot(sample = mpg, data = mtcars)
qplot(sample = mpg, data = mtcars, colour = factor(cyl))    

## End(Not run)

[Package ggplot2 version 0.8.9 Index]