ggpubr包提供了绘制ggpaired
成对数据的功能。它没有这样的add='jitter'
选项ggboxplot
。
是否可以通过不同的方式达到类似的效果?
文档中的示例:
require(ggplot)
require(ggpubr)
before <-c(200.1, 190.9, 192.7, 213, 241.4, 196.9, 172.2, 185.5, 205.2, 193.7)
after <-c(392.9, 393.2, 345.1, 393, 434, 427.9, 422, 383.9, 392.3, 352.2)
d <- data.frame(before = before, after = after)
ggpaired(d, cond1 = "before", cond2 = "after", add="jitter")
data("ToothGrowth")
df <- ToothGrowth
ggboxplot(df, x = "dose", y = "len", width = 0.8, add="jitter")