正文
## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 4 5.8 VC 0.5
## 5 6.4 VC 0.5
## 6 10.0 VC 0.5
p #增加了jitter点,点shape由dose映射
p
增加不同组间的p-value值,可以自定义需要标注的组间比较
my_comparisons #不同组间的比较
stat_compare_means(label.y = 50)
内有箱线图的小提琴图
ggviolin(df1, x="dose", y="len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"),
add = "boxplot", add.params = list(fill="white"))+
stat_compare_means(comparisons = my_comparisons, label = "p.signif")+#label这里表示选择显著性标记(星号)
stat_compare_means(label.y = 50)
条形图
data("mtcars")
df2 #添加一行name
head(df2[, c("name", "wt", "mpg", "cyl")])
按从小到大顺序绘制条形图(不分组排序)
ggbarplot(df2, x="name", y="mpg", fill = "cyl", color = "white",
palette = "jco", #杂志jco的配色
sort.val = "desc", #下降排序
sort.by.groups=FALSE, #不按组排序
x.text.angle=60)
按组进行排序
ggbarplot(df2, x="name", y="mpg", fill = "cyl", color = "white",
palette = "jco",#杂志jco的配色
sort.val = "asc",#上升排序,区别于desc,具体看图演示
sort.by.groups=TRUE,#按组排序 x.text.angle=90)