x
-axis variable.R/helpers_gghistostats_graphics.R
histo_labeller.Rd
Helper function for adding centrality parameter value and/or a
test value for the continuous, numeric x
-axis variable.
histo_labeller( plot, x, type = "parametric", tr = 0.1, centrality.k = 2L, centrality.line.args = list(color = "blue", size = 1), centrality.label.args = list(color = "blue"), ... )
plot | A |
---|---|
x | A numeric variable from the dataframe |
type | Type of statistic expected ( |
tr | Trim level for the mean when carrying out |
centrality.k | Integer denoting the number of decimal places expected
for centrality parameter label. (Default: |
centrality.line.args, test.value.line.args | A list of additional
aesthetic arguments to be passed to the |
centrality.label.args, test.value.label.args | A list of additional
aesthetic arguments to be passed to the |
... | Currently ignored. |
# \donttest{ library(ggplot2) # creating a plot; lines and labels will be superposed on this plot p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # computing `y`-axis positions for line labels y_label_pos <- median( x = ggplot2::layer_scales(p)$y$range$range, na.rm = TRUE ) # adding labels ggstatsplot:::histo_labeller( plot = p, x = mtcars$wt, y.label.position = y_label_pos, test.value.line = TRUE )# }