R语言ggplot2可视化:为箱图的均值进行连线、将多个分组的均值连接起来Joining means on a boxplot with a line
目录
R语言ggplot2可视化:为箱图的均值进行连线、将多个分组的均值连接起来Joining means on a boxplot with a line
#为箱图的均值进行连线
library(ggplot2)
x <- factor(rep(1:10, 100))
y <- rnorm(1000)
df <- data.frame(x=x, y=y)
ggplot(df, aes(x=x, y=y)) +
geom_boxplot() +
stat_summary(fun=mean, geom="line", aes(group=1))