R/geom_halfeyeh.R
geom_halfeyeh.Rd
Generates a combination of a density and stat_pointintervalh
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 "halfeye" 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)
mapping  The aesthetic mapping, usually constructed with


data  A layer specific dataset  only needed if you want to override the plot defaults. 
position  The position adjustment to use for overlapping points on this layer. 
trim  If 
scale  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. 
relative_scale  A relative scaling factor to determine how much of the available
space densities are scaled to fill: if 
fill  Fill color of the density. 
density.color  Outline color of the density.
The default, 
...  Currently unused. 
point_interval  A function that when given a vector should
return a data frame with variables 
fun.data  Similar to 
fun.args  Optional arguments passed to 
.width  The 
.prob  Deprecated. Use 
color  Passed to 
size  Passed to 
size_domain  The minimum and maximum of the values of the size aesthetic that will be translated into actual
sizes drawn according to 
size_range  This geom scales the raw size aesthetic values, as they tend to be too thick when using the default
settings of 
fatten_point  A multiplicative factor used to adjust the size of the point relative to the size of the thickest line. 
A halfeye 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.
See geom_eye
and geom_eyeh
for the mirroreddensity
(full "eye") versions. See geom_density_ridges
and stat_summaryh
for the geoms
this function is based on.
library(magrittr) library(ggplot2) data(RankCorr, package = "tidybayes") RankCorr %>% spread_draws(u_tau[i]) %>% ggplot(aes(y = i, x = u_tau)) + geom_halfeyeh()