我正在尝试为一些箱线图添加geom_smooth()
趋势,但是我的图层没有正确的合并。
我该如何将这两个图层合并在一起呢?
geom_boxplot:
ggplot(test) + geom_boxplot(aes(x=factor(year), y = dm))
geom_smooth
该功能可在ggplot2中用于创建平滑拟合线。ggplot(test, aes(year, dm)) + geom_smooth()
geom_boxplot和geom_smooth都可以使用
ggplot(test) + geom_boxplot(aes(x=factor(year), y = dm)) + geom_smooth(aes(x = year, y = dm))
?geom_boxplot
)。"只要提供分组变量,您也可以使用连续的x轴制作箱线图。" - Henrik