将中位数更改为ggpubr-r

时间:2020-06-30 08:37:33

标签: r boxplot ggpubr

我有一个ggpubr箱线图,我希望中线是均值而不是中位数,是否有人知道如何做? 现在,我将中位数作为直线,将均值作为点,我想删除中位数,然后将均值添加为直线。

> head(my_data)
# A tibble: 6 x 3
  SHM_level Batch_number Isotypes
      <dbl>        <dbl> <chr>   
1        11            4 IgM     
2         3            4 IgM     
3         5            4 IgM     
4        20            4 IgM     
5         5            4 IgM     
6         5            4 IgM 

我的代码:

 #perform test
compare_means(SHM_level ~ Isotypes, data = my_data, group.by = "Batch_number")
#plot    
p1<- ggboxplot(my_data, x = "Batch_number", y = "SHM_level",
                  color = "Isotypes", palette = "jco", add = "mean")+ggtitle("DLN")+ylim(0,40)+
      stat_compare_means(aes(group = Isotypes), label = "p.signif")+xlab("Batch number")+
      ylab("SHM level")

图: enter image description here

谢谢!

0 个答案:

没有答案