我想在堆叠的条形图上添加线条,以便逐组显示进化。目前,我找到了 ggpubr 包的替代解决方案。
任何帮助将不胜感激!谢谢 !
# My dataset
dff
# day composition median
# 1 JO a 12.21
# 2 JO b 0.79
# 3 JO c 42.06
# 4 JO d 30.65
# 5 JO e 0.00
# 6 J28 a 1.28
# 7 J28 b 0.38
# 8 J28 c 85.13
# 9 J28 d 7.90
# 10 J28 e 0.00
# Stacked barplot
library(ggplot2)
ggplot(data = dff) +
geom_col(aes(x = day, y = median, fill = composition)) +
ylim(0,100)
# Median linked by lines
library(ggpubr)
ggpaired(data = dff,x = "day", y = "median", color = "composition",
line.color = "gray", line.size = 0.4, xlab = FALSE, ylab = "Median")