Generates a combination of a density and
representing the density, point summary, and uncertainty intervals
for draws from a distribution. Useful for representing posteriors from Bayesian models;
in that context the mirrored version is variously called an eye plot, a raindrop plot,
violin plot; hence "half-eye" for this plot.
geom_halfeyeh(mapping = NULL, data = NULL, position = "identity", trim = TRUE, scale = "area", relative_scale = 1, fill = NULL, density.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)
The aesthetic mapping, usually constructed with
A layer specific dataset - only needed if you want to override the plot defaults.
The position adjustment to use for overlapping points on this layer.
If "area" (default), all densities have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all densities have the same maximum width/height.
A relative scaling factor to determine how much of the available
space densities are scaled to fill: if
Fill color of the density.
Outline color of the density.
A function that when given a vector should
return a data frame with variables
Optional arguments passed to
The minimum and maximum of the values of the size aesthetic that will be translated into actual
sizes drawn according to
This geom scales the raw size aesthetic values, as they tend to be too thick when using the default
A multiplicative factor used to adjust the size of the point relative to the size of the thickest line.
A half-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 density plot, point summary, and one or more uncertainty intervals.
geom_halfeyeh() is roughly equivalent to
geom_density_ridges() + stat_pointintervalh()
with some reasonable defaults, including color choices and the use of median with 95%
and 66% quantile intervals.
library(magrittr) library(ggplot2) data(RankCorr, package = "tidybayes") RankCorr %>% spread_draws(u_tau[i]) %>% ggplot(aes(y = i, x = u_tau)) + geom_halfeyeh()