1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/YZGROUP/personalbio/transcriptome/software/R-3.4.2-1/bin/Rscript
- argv=commandArgs(TRUE)
- #setwd("C:/Users/lenovo/Desktop")
- #argv=c("TF.out.count.txt","TF.out.count")
- if(length(argv)==0){
- cat("USAGE:\n")
- cat(" $0 <TF.count.txt> <TF.count_prefix>\n\n")
- q()
- n
- }
- library(ggplot2)
- file_in=argv[1]
- pdf=paste(argv[2],".pdf",sep="")
- png=paste(argv[2],".png",sep="")
- #file_in="InDels_length_stat.summary"
- dt=read.table(file_in,head=T,sep="\t")
- dt=dt[order(dt[,2],decreasing=TRUE),]
- dt[,1]=factor(as.character(dt[,1]),levels=as.character(dt[,1]))
- q=ggplot(dt, aes(x = Family, y = Count))+
- geom_bar(stat="identity",width=0.7,fill="blue")+
- ylab("Count")+xlab("TF Family")+
- scale_fill_brewer(palette = "Set2")+
- theme(axis.text.x = element_text(angle=0),
- legend.title = element_blank(),
- panel.border = element_blank(),
- panel.grid.major.x = element_blank()) +
- #再加上坐标轴(无刻度、无标签
- #theme(axis.line = element_line(size=1, colour = "black"))
- theme_bw()+
- theme(strip.text = element_text(size = 10, color = "black", face = "bold"))+
- #修改坐标轴刻度标签
- theme(axis.text = element_text(size = 10, color = "black", face = "bold"))+
- #修改坐标轴标签
- theme(axis.title = element_text(size = 10, color = "black", face = "bold"))+
- #修改坐标轴标签
- theme(axis.text.x = element_text(size = 7,angle=90, color = "black",vjust=0.4,hjust=1, face = "bold"))+
- #对legend的内容做修改
- theme(legend.text= element_text(size=10, color="black", face = "bold", vjust=0.5, hjust=0.5)) + scale_y_continuous(expand = c(0.02,0.02))
- #对legend的title做修改
- #theme(legend.title= element_text(size=15, color="black", face = "bold", vjust=0.5, hjust=0.5))
- q
- ggsave(pdf,width=8,height=5)
- ggsave(png,width=8,height=5)
|