Continuous quantiles
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.
group: ..quantile..
size: ..quantile..
(scales: area, manual, size, size_discrete)
To use these variables in an aesthetic mapping, you need to surrond them with .., like aes(x = ..output..)
.
quantile
, quantile of distributionWhen an aesthetic is used an a parameter, like stat_quantile(quantiles = 3)
, it will override mappings from data.
quantiles
, conditional quantiles of y to calculate and displayformula
, formula relating y variables to x variablesxseq
, exact points to evaluate smooth at, overrides ngeom_quantile. Override with the geom
argument: stat_quantile(geom="point")
.
> 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"