| StatSdRuler | R Documentation |
StatSdRuler reduces each panel to the segment for one standard deviation,
anchored at the outcome's mean. With x and y aesthetics, the outcome is
y; the ruler is vertical and where places it along x. With x alone,
the outcome is x and the ruler runs along the baseline from the mean to
one standard deviation above it.
StatSdRuler
stat_sd_ruler(
mapping = NULL,
data = NULL,
geom = "segment",
position = "identity",
...,
where = "middle",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. |
geom |
The geometric object used to display the data. Defaults to
|
position |
A position adjustment. Defaults to |
... |
Other arguments passed to |
where |
With both |
na.rm |
If |
show.legend |
Logical. Should this layer be included in the legends? |
inherit.aes |
If |
A ggplot2::Stat object.
stat_sd_ruler() is the conventional layer constructor. It uses the same
stat as gf_sd_ruler(), so both interfaces measure transformed values and
compute one ruler from each panel's rows. Groups within a panel do not get
separate rulers. Styling aesthetics from the source data cannot be mapped;
set them to one value, or facet the plot to draw one ruler per group.
stat_sd_ruler() returns a ggplot2 layer.
gf_sd_ruler() provides the ggformula interface.
ggplot2::ggplot(Fingers, ggplot2::aes(Height, Thumb)) +
ggplot2::geom_point() +
stat_sd_ruler(where = "mean", colour = "red", linewidth = 1)
ggplot2::ggplot(Fingers, ggplot2::aes(Thumb)) +
ggplot2::geom_histogram(bins = 30) +
stat_sd_ruler(colour = "red", linewidth = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.