使用R画Wilkinson图

来源:互联网 发布:tomcat9启动 源码解析 编辑:程序博客网 时间:2024/05/27 14:13

使用R画的,需要有R基础。
输入文件格式(三列)

Location marker Lr Location_1 A 2.7 Location_1 A 3.8 Location_1 A 3 Location_1 A 3.3 Location_1 A 1.8

代码

library(ggplot2)data <- read.table('/Users/xxx/Desktop/test.txt',sep='\t',header=T)head(data)ggplot(data, aes(x=marker, y=Lr)) + geom_dotplot(binaxis="y",fill="white", binwidth=0.5,stackdir="center", dotsize=0.24) + stat_summary(fun.data=mean_sdl, fun.args = list(mult=1), geom="errorbar", color="blue", width=0.2) + stat_summary(fun.y=mean, geom="point", color="blue")+ facet_wrap(~ Location, ncol = 2) + guides(fill=FALSE) + theme(panel.background = element_rect(fill = 'white'),axis.line = element_line(size=0.5, colour = "black"))+ylab("Infection type") + scale_y_continuous(breaks=c(1,2,3,4,5,6,7,8,9))+scale_x_discrete(breaks=c("A","B"),labels=c("A-type","B-type"))gsave(filename="/Users/xxx/Desktop/markdown/图片/test_2.png",dpi=300)

这里写图片描述