Generates a combination geom_violin and stat_pointinterval (for geom_eye) or geom_violinh and stat_pointintervalh (for geom_eyeh) representing the density, point summary, and uncertainty intervals for draws from a distribution. Useful for representing posteriors from Bayesian models; in that context this is variously called an eye plot, a raindrop plot, or a violin plot (though violin plot is also applied to plots of data, hence its use is not preferred here).

geom_eye(mapping = NULL, data = NULL, position = "identity",
trim = TRUE, scale = "area", relative_scale = 1, fill = NULL,
violin.color = NA, ..., point_interval = median_qi,
fun.data = NULL, fun.args = list(), .width = c(0.66, 0.95), .prob,
color = NULL, size = NULL, size_domain = NULL, size_range = NULL,
fatten_point = NULL)

geom_eyeh(mapping = NULL, data = NULL, position = "identity",
trim = TRUE, scale = "area", relative_scale = 1, fill = NULL,
violin.color = NA, ..., point_interval = median_qi,
fun.data = NULL, fun.args = list(), .width = c(0.66, 0.95), .prob,
color = NULL, size = NULL, size_domain = NULL, size_range = NULL,
fatten_point = NULL)

## Arguments

mapping The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults. A layer specific dataset - only needed if you want to override the plot defaults. Passed to geom_violin / geom_violinh. The position adjustment to use for overlapping points on this layer. Passed to geom_violin / geom_violinh. If TRUE (default), trim the tails of the violins to the range of the data. If FALSE, don't trim the tails. Passed to geom_violin / geom_violinh. If "area" (default), all violins have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width. A relative scaling factor to determine how much of the available space densities are scaled to fill: if 1, all available space is filled. Passed to geom_violin / geom_violinh. Fill color of the violin. Passed as the color argument of geom_violin / geom_violinh. The default, NA, suppresses the violin outline. Set to another value to set the violin outline color manually, or set to NULL if you want the outline color of the violin to be determined by the aesthetic mapping. Currently unused. A function that when given a vector should return a data frame with variables y, ymin, ymax, and .width; or x, xmin, xmax, and .width. Either is acceptable: output will be converted into the y-based aesthetics for geom_eye and the x-based aesthetics for geom_eyeh. See the point_interval family of functions. Similar to point_interval, for compatibility with stat_summary. Note: if the summary function is passed using fun.data, the x and y-based aesthetics are not converted to the correct form automatically. Optional arguments passed to fun.data. The .width argument passed to point_interval. Deprecated. Use .width instead. Passed to stat_pointinterval. Color of the point summary and uncertainty interval. Passed to stat_pointinterval. Line weight of the point summary and uncertainty interval. The minimum and maximum of the values of the size aesthetic that will be translated into actual sizes drawn according to size_range (see the documentation for that argument, below.) This geom scales the raw size aesthetic values, as they tend to be too thick when using the default settings of scale_size_continuous, which give sizes with a range of c(1, 6). The size_domain value indicates the input domain of raw size values (typically this should be equal to the value of the range argument of the scale_size_continuous function), and size_range indicates the desired output range of the size values (the min and max of the actual sizes used to draw intervals). A multiplicative factor used to adjust the size of the point relative to the size of the thickest line.

## Details

An eye plot is a compact visual summary of the distribution of a sample, used (under various names and with subtle variations) to visualize posterior distributions in Bayesian inference. This instantiation is a combination of a violin plot, point summary, and one or more uncertainty intervals.

The vertical form, geom_eye, is equivalent to geom_violin() + stat_pointinterval() with some reasonable defaults, including color choices and the use of median with 95% and 66% quantile intervals.

The horizontal form, geom_eyeh(), is equivalent to geom_violinh() + stat_pointintervalh().

See geom_halfeyeh for the non-mirrored density ("half eye") version. See geom_violin and stat_pointinterval for the geoms these functions are based on.

## Examples


library(magrittr)
library(ggplot2)

data(RankCorr, package = "tidybayes")

RankCorr %>%