You can do like this using annotate
and capture.output
:
library(ggplot2)
data("iris")
m <- loess(Petal.Length ~ Sepal.Length, data = iris)
out <- capture.output(print(summary(m)))
out2 <- paste0(out[-1], "", collapse = "\n")
ggplot(iris, aes(Sepal.Length, Petal.Length)) +
geom_point() +
geom_smooth() +
annotate("text", label = out2, x = 4, y = 5, size = 6, hjust = 0)
Please see the result below.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.