require(ggplot2)
## Loading required package: ggplot2
require(grid)
## Loading required package: grid
#画布与布局
grid.newpage()
pushViewport(viewport(layout = grid.layout(2,2)))
vplayout = function(x,y)viewport(layout.pos.row = x,layout.pos.col = y)
#读入数据
len_distribution = read.table(file = "C:/Users/Administrator/Desktop/data/filter_detail_stat_aa.txt",header = TRUE,sep = "")
in_frame = read.table(file = "C:/Users/Administrator/Desktop/data/in_frame.stat",header = TRUE,sep = "")
sample_10 = len_distribution[len_distribution$Sample == "10_4",]
sample_4 = len_distribution[len_distribution$Sample == "4_4",]
sample_7 = len_distribution[len_distribution$Sample == "7WBA",]
p1 = ggplot(sample_4,aes(x = Len,y = Percent))+geom_bar(aes(fill = Type),position = "dodge",stat="identity")+theme_bw()+theme(legend.position = "none")+xlim(0,50)+theme(axis.line = element_line(colour="black"),panel.border = element_blank())
p2 = ggplot(sample_7,aes(x = Len,y = Percent))+geom_bar(aes(fill = Type),position = "dodge",stat="identity")+xlim(0,50)+theme_bw()+theme(legend.position = c(0.88,0.8))+theme(legend.background = element_blank())+theme(axis.line = element_line(colour="black"),panel.border = element_blank())
p3 = ggplot(sample_10,aes(x = Len,y = Percent))+geom_bar(aes(fill = Type),position = "dodge",stat="identity")+theme_bw()+theme(legend.position = "none")+xlim(0,50)+theme(axis.line = element_line(colour="black"),panel.border = element_blank())
p4 = ggplot(in_frame,aes(x=type,y=percent))+geom_point(aes(colour=type))+geom_line(aes(group=sample))+theme_bw()+theme(legend.position = c(0.88,0.2))+theme(legend.background=element_blank())+theme(legend.key=element_blank())+theme(axis.line = element_line(colour="black"),panel.border = element_blank())
print(p1,vp=vplayout(1,1))
print(p2,vp=vplayout(1,2))
print(p3,vp=vplayout(2,1))
print(p4,vp=vplayout(2,2))
