# NOT RUN {
library(tibble)
ggplot(lynx, as.numeric = FALSE) + geom_line() +
stat_peaks(colour = "red") +
stat_peaks(geom = "text", colour = "red", angle = 66,
hjust = -0.1, x.label.fmt = "%Y") +
ylim(NA, 8000)
formula <- y ~ poly(x, 2, raw = TRUE)
ggplot(cars, aes(speed, dist)) +
geom_point() +
geom_smooth(method = "lm", formula = formula) +
stat_poly_eq(aes(label = ..eq.label..), formula = formula,
parse = TRUE)
formula <- y ~ x
ggplot(PlantGrowth, aes(group, weight)) +
stat_summary(fun.data = "mean_se") +
stat_fit_tb(method = "lm",
method.args = list(formula = formula),
tb.type = "fit.anova") +
theme_classic()
# }
Run the code above in your browser using DataLab