且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将简单的lm趋势线添加到ggplot boxplot

更新时间: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))