Fig3-d 箱图的绘制 2020-12-17

数据准备与格式:

读取数据

d<-read.csv(file.choose())
d

导入需要的包:

library(ggplot2)
library(ggthemr)   
library(ggpubr)
ggthemr("flat") 

进行绘图与修饰:

fig3d <- ggplot(d, aes(Interactions, Fold, fill = Interactions)) + geom_boxplot()  

fig3d <-fig3d +geom_signif(comparisons = compaired, step_increase = 0.3, map_signif_level = F, test = wilcox.test)

fig3d <-fig3d +stat_compare_means(comparisons = compaired)

fig3d <-fig3d + stat_compare_means(label.y =0.65, label.x = 1.5) 

fig3d <-fig3d+ theme_bw()+ggtitle("Average growth fold change in co-cultures") +theme(plot.title = element_text(hjust = 0.5))

fig3d <-fig3d+theme(legend.position='none')

fig3d <-fig3d +theme(axis.title.x = element_blank())

fig3d

得到:

image.png

如果需要,可以进行组合:

library(ggpubr)#加载包
fig3final<-ggarrange(fig3b,fig3d,fig3e,labels = c("b","d","e", ncol=1,nrow=3))
fig3final
image.png

你可能感兴趣的:(Fig3-d 箱图的绘制 2020-12-17)