
Last chance! 50% off unlimited learning
Sale ends in
Adds a label to the horizontal or vertical line.
line_labeller(
plot,
x,
y,
k = 2,
color,
label.text,
line.direction = "vline",
jitter = 0.25
)line_labeler(
plot,
x,
y,
k = 2,
color,
label.text,
line.direction = "vline",
jitter = 0.25
)
A ggplot
object in which the label needs to be displayed.
The x
- and y
-axes coordinates for the label.
Number of digits after decimal point (should be an integer)
(Default: k = 2
).
Color of the label.
The text to include in the label (e.g., "mean"
).
Character that specifies whether the line on which
label is to be attached is vertical ("vline"
, default) or horizontal
("hline"
) line.
Numeric that specifies how much the label should be jittered in
the vertical direction (default: 0.25
). The sign will determine the
direction (upwards or downwards).
# NOT RUN {
# creating a basic plot
set.seed(123)
library(ggplot2)
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
# adding a label
ggstatsplot:::line_labeller(
plot = p,
x = median(mtcars$wt),
y = mean(mtcars$mpg),
k = 2,
color = "red",
label.text = "median"
)
# }
Run the code above in your browser using DataLab