Description Usage Arguments Aesthetics See Also Examples
For every value of x, computes quantiles of y and uses these to plot
intervals containing increasing proportions of the total density of y.
Boundaries of intervals are mapped to linetype. Quantiles can also be
precomputed and mapped to the aesthetic quantile.
This function is designed with the need to summarise MCMC posterior
distributions in mind.
1 2 3 4 5 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
Use to override the default use of |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
intervals |
specify the collection of intervals to be represented in the fan. |
lineend |
Line end style (round, butt, square). |
linejoin |
Line join style (round, mitre, bevel). |
linemitre |
Line mitre limit (number greater than 1). |
arrow |
Arrow specification, as created by |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
geom_interval understands the following aesthetics (required aesthetics are in bold):
x
y
quantile
group
colour
size
stat_summary Summarises y at each value of x
stat_quantile Uses quantile regression to predict quantiles
geom_fan Plot intervals on a continuous colour scale
1 2 3 4 5 6 7 8 9 10 11 12 | library(ggplot2)
# Basic use. The data frame must have multiple y values for each
# x
ggplot(fake_df, aes(x=x,y=y)) +geom_interval()
# use precomputed quantiles - reducing storage requirements.
intervals = c(0,50,90)/100
fake_q <- calc_quantiles(fake_df, intervals=intervals)
# intervals in geom_fan must be the same as used to compute quantiles.
ggplot(fake_q, aes(x=x,y=y, quantile=quantile)) +
geom_interval(intervals=intervals)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.