Multiple uncertainty interval plots (ggplot geom)
Multiple interval geoms with default aesthetics
designed for use with output from point_interval().
Wrapper around geom_slabinterval().
geom_interval( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., side = "both", orientation = NA, interval_size_range = c(1, 6), show_slab = FALSE, show_point = FALSE )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
The position adjustment to use for overlapping points on this layer. Setting this equal to
|
... |
Arguments passed on to
|
side |
Which side to draw the slab on. |
orientation |
Whether this geom is drawn horizontally ( |
interval_size_range |
(Deprecated). This geom scales the raw size aesthetic values when drawing interval and point sizes, as
they tend to be too thick when using the default settings of |
show_slab |
Should the slab portion of the geom be drawn? Default |
show_point |
Should the point portion of the geom be drawn? Default |
These geoms are wrappers around geom_slabinterval() with defaults designed to produce
multiple interval plots. These geoms set some default aesthetics equal
to the .lower, .upper, and .width columns generated by the point_interval family
of functions, making them often more convenient than vanilla geom_linerange()
when used with functions like median_qi(), mean_qi(),
mode_hdi(), etc.
Specifically, geom_interval acts as if its default aesthetics are
aes(color = fct_rev(ordered(.width))).
A ggplot2::Geom representing a multiple interval geometry which can
be added to a ggplot() object.
These geoms support the following aesthetics:
x
y
datatype
alpha
colour
colour_ramp
linetype
fill
shape
stroke
point_colour
point_fill
point_alpha
point_size
size
interval_colour
interval_alpha
interval_size
interval_linetype
slab_size
slab_colour
slab_fill
slab_alpha
slab_linetype
fill_ramp
ymin
ymax
xmin
xmax
width
height
thickness
group
See examples of some of these aesthetics in action in vignette("slabinterval").
Learn more about the sub-geom aesthetics (like interval_color) in the scales documentation.
Learn more about basic ggplot aesthetics in vignette("ggplot2-specs").
Matthew Kay
See stat_interval() for the stat version, intended
for use on samples from a distribution.
See geom_interval() for a similar geom intended for intervals without
point summaries.
See stat_sample_slabinterval() for a variety of other
stats that combine intervals with densities and CDFs.
See geom_slabinterval() for the geom that these geoms wrap. All parameters of that geom are
available to these geoms.
library(dplyr) library(ggplot2) theme_set(theme_ggdist()) data(RankCorr_u_tau, package = "ggdist") # orientation is detected automatically based on # use of xmin/xmax or ymin/ymax RankCorr_u_tau %>% group_by(i) %>% median_qi(.width = c(.5, .8, .95, .99)) %>% ggplot(aes(y = i, x = u_tau, xmin = .lower, xmax = .upper)) + geom_interval() + scale_color_brewer() RankCorr_u_tau %>% group_by(i) %>% median_qi(.width = c(.5, .8, .95, .99)) %>% ggplot(aes(x = i, y = u_tau, ymin = .lower, ymax = .upper)) + geom_interval() + scale_color_brewer()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.