# NOT RUN {
library(ggplot2)
# creating a ploton which lines and labels are to be superposed
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
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab