Description Usage Arguments Functions Examples
add summary statistics onto a ggplot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | add_summary(p, fun = "mean_se", error.plot = "pointrange",
color = "black", fill = "white", width = NULL, shape = 19, size = 1,
data = NULL, position = position_dodge(0.8))
mean_se_(x, error.limit = "both")
mean_sd(x, error.limit = "both")
mean_ci(x, ci = 0.95, error.limit = "both")
mean_range(x, error.limit = "both")
median_iqr(x, error.limit = "both")
median_mad(x, error.limit = "both")
median_range(x, error.limit = "both")
|
p |
a ggplot on which you want to add summary statistics. |
fun |
a function that is given the complete data and should return a data frame with variables ymin, y, and ymax. Allowed values are one of: "mean", "mean_se", "mean_sd", "mean_ci", "mean_range", "median", "median_iqr", "median_mad", "median_range". |
error.plot |
plot type used to visualize error. Allowed values are one of
|
color |
point or outline color. |
fill |
fill color. Used only whne |
width |
numeric value between 0 and 1 specifying bar or box width.
Example width = 0.8. Used only when |
shape |
point shape. Allowed values can be displayed using the function
|
size |
numeric value in [0-1] specifying point and line size. |
data |
a |
position |
position adjustment, either as a string, or the result of a call to a position adjustment function. Used to adjust position for multiple groups. |
x |
a numeric vector. |
error.limit |
allowed values are one of ("both", "lower", "upper", "none") specifying whether to plot the lower and/or the upper limits of error interval. |
ci |
the percent range of the confidence interval (default is 0.95). |
add_summary
: add summary statistics onto a ggplot.
mean_se_
: returns the mean
and the error limits defined by the
standard error
. We used the name mean_se_
() to avoid masking mean_se
().
mean_sd
: returns the mean
and the error limits defined by the
standard deviation
.
mean_ci
: returns the mean
and the error limits defined by the
confidence interval
.
mean_range
: returns the mean
and the error limits defined by the
range = max - min
.
median_iqr
: returns the median
and the error limits
defined by the interquartile range
.
median_mad
: returns the median
and the error limits
defined by the median absolute deviation
.
median_range
: returns the median
and the error limits
defined by the range = max - min
.
1 2 3 4 5 6 | # Basic violin plot
p <- ggviolin(ToothGrowth, x = "dose", y = "len", add = "none")
p
# Add median_iqr
add_summary(p, "mean_sd")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.