❝2、单细胞转录组全流程代码需收费,收费代码包含公众号付费内容,也有很多新增加的内容。需进群或者需单细胞代码的小伙伴请添加作者微信了解,请备注目的,除此之外请勿添加,谢谢!
3、付费文章集合有打包价哦!
详情请联系作者:
❞
setwd('D:/KS项目/公众号文章/配对箱线图颜色配对')
df <- read.csv('df.csv', header = T)
library(ggplot2)
library(ggpubr)
#1
ggplot(data=df, aes(x = Disease.state, y = Richness,
color=Disease.state)) +
geom_boxplot(alpha =0.5,size=1,outlier.shape = NA)+
scale_color_manual(limits=c("Patient","Relative"),
values=c("#E29827","#922927"))+
stat_compare_means(method = "t.test",paired = TRUE,
comparisons=list(c("Patient", "Relative")))+
geom_jitter(alpha = 0.3,size=3, aes(fill=indi),shape=21)+
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
facet_wrap(~sample, scales = "free_y")+
theme_bw() +
theme(panel.grid =element_blank(),
axis.text = element_text(size = 10,colour = "black"),
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
legend.position = 'top')+
labs(y='Expression')
ggplot(data=df, aes(x = Disease.state, y = Richness,
color=Disease.state)) +
geom_boxplot(alpha =0.5,size=1,outlier.shape = NA)+
scale_color_manual(limits=c("Patient","Relative"),
values=c("#E29827","#922927"))+
stat_compare_means(method = "t.test",paired = TRUE,
comparisons=list(c("Patient", "Relative")))+
geom_jitter(alpha = 0.3,size=3, aes(fill=indi),shape=21)+
geom_line(aes(group = Family.ID),
color = 'grey40', lwd = 0.5)+
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
facet_wrap(~sample, scales = "free_y")+
theme_bw() +
theme(panel.grid =element_blank(),
axis.text = element_text(size = 10,colour = "black"),
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
legend.position = 'top')+
labs(y='Expression')
ggplot(data=df, aes(x = Disease.state, y = Richness,
color=Disease.state)) +
geom_boxplot(alpha =0.5,size=1,outlier.shape = NA)+
scale_color_manual(limits=c("Patient","Relative"),
values=c("#E29827","#922927"))+
stat_compare_means(method = "t.test",paired = TRUE,
comparisons=list(c("Patient", "Relative")))+
geom_jitter(size=3, aes(fill=indi),
shape=21,position = position_dodge(0.5))+
geom_line(aes(group = Family.ID),
color = 'grey40', lwd = 0.5,position = position_dodge(0.5))+ #添加连线
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
facet_wrap(~sample, scales = "free_y")+
theme_bw() +
theme(panel.grid =element_blank(),
axis.text = element_text(size = 10,colour = "black"),
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
legend.position = 'top')+
labs(y='Expression')
效果很好,可以应用到配对数据的可视化和分析。觉得分享有用的,点个赞、分享一下再走呗!!!
联系客服