# NOT RUN {
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
)
# }
Run the code above in your browser using DataLab