stat_quantile

Continuous quantiles

Details

See layer and qplot for more information on creating a complete plot from multiple components.

Aesthetics

The following aesthetics can be used with stat_quantile. They are listed along with their default value. All geoms and scales can also use the group aesthetic. Read how this important aesthetic works in scale_group. Typically, you will associate an aesthetic with a variable in your data set. To do this, you use the aes function: stat_quantile(aes(x = var)). Scales control the details of the mapping between data and aesthetic properties; after each aesthetic are listed scales that can be used with that aesthetic. The scale documentation will also provide references to help you interpret the default values.

Instead of mapping an aesthetic to a variable in your dataset, you can also set it to a fixed value. See the parameters section for details.

New variables produced by the statistic

To use these variables in an aesthetic mapping, you need to surrond them with .., like aes(x = ..output..).

Parameters

When an aesthetic is used an a parameter, like stat_quantile(quantiles = 3), it will override mappings from data.

Default geom

geom_quantile. Override with the geom argument: stat_quantile(geom="point").

Examples


> m <- ggplot(movies, aes(y=rating, x=year)) + geom_point()
> m + stat_quantile()


> m + stat_quantile(quantiles = seq(0.05, 0.95, by=0.05))


> m + stat_quantile(formula=y~x)


> 
> # Add aesthetic mappings
> m + stat_quantile(aes(weight=votes))


> 
> # Change scale
> m + stat_quantile(aes(colour = ..quantile..), quantiles = seq(0.05, 0.95, by=0.05))


> m + stat_quantile(aes(colour = ..quantile..), quantiles = seq(0.05, 0.95, by=0.05)) +(midpoint=0.5, low="green", mid="yellow", high="green")


> 
> # Set aesthetics to fixed value
> m + stat_quantile(colour="red", size=2, linetype=2)


> 
> # Use qplot instead
> qplot(year, rating, data=movies, geom="quantile")

 src 
"\n"