A publisher requires a scientific notation in my plot.

My code (simplified) is as follows:
set.seed(123)
n <- 100
x <- rnorm(n)
y <- 2 * x + rnorm(n, sd = 0.5)
data <- data.frame(x = x, y = 1.4 * x + rnorm(100, sd = 2))
ggplot(data, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor()
I tried:
ggplot(df, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor(
aes(label = paste("R =", ..r.., "\nP =", format.pval(..p.., digits = 2,
scientific = TRUE))), parse = TRUE)
ggplot(df, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor(
aes(label = ..r.label..~"\nP ="~format.pval(..p.., digits = 2,
scientific = TRUE)))
ggplot(df, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor(
aes(label = paste("R =", ..r.., "\nP =", format.pval(..p.., digits = 2, scientific = TRUE)))
ggplot(df, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor(
aes(label = paste(..r.label.., "\n", ..p.label..)))
ggplot(df, aes(x, y)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
ggpubr::stat_cor(
aes(label = paste(..r.label.., "\nP =", format(..p.., scientific = TRUE))))
but none of these works. Or at least how to manually add an annotation with annotate()?
Does anyone know how to do that?
