更新时间:2023-12-01 21:40:10
The error message is pretty much self-explanatory: Add aes(group=1)
to geom_smooth
:
ggplot(iris, aes(factor(Sepal.Length), Sepal.Width)) +
geom_boxplot() +
geom_smooth(method = "lm", se=FALSE, color="black", aes(group=1))