Adding labels for mean values.
mean_ggrepel(plot, mean.data, mean.size = 5, mean.color = "darkred",
mean.label.size = 3, mean.label.fontface = "bold",
mean.label.color = "black", inherit.aes = TRUE, ...)
A ggplot
object for which means are to be displayed.
A dataframe containing means for each level of the factor.
The columns should be titled x
, y
, and label
.
Point size for the data point corresponding to mean
(Default: 5
).
Color for the data point corresponding to mean (Default:
"darkred"
).
Aesthetics for
the label displaying mean. Defaults: 3
, "bold"
,"black"
, respectively.
Aesthetics for
the label displaying mean. Defaults: 3
, "bold"
,"black"
, respectively.
Aesthetics for
the label displaying mean. Defaults: 3
, "bold"
,"black"
, respectively.
If FALSE
, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. borders
.
Additional arguments.
# NOT RUN {
# }
# NOT RUN {
# this internal function may not have much utility outside of the package
set.seed(123)
library(ggplot2)
# make a plot
p <- ggplot(data = iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot()
# get a dataframe with means
mean_dat <- ggstatsplot:::mean_labeller(
data = iris,
x = Species,
y = Sepal.Length,
mean.ci = TRUE,
k = 3
) %>%
dplyr::rename(.data = ., x = Species, y = Sepal.Length)
# add means
ggstatsplot:::mean_ggrepel(
plot = p,
mean.data = mean_dat,
mean.color = "darkgreen"
)
# }
Run the code above in your browser using DataLab