全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1449 1
2017-10-21
悬赏 1 个论坛币 未解决
【求助】  麻烦问下像这样的条形图如何实现?  每根柱子代表分别代表正负增长的比例
图片1.png

原图尺寸 32.59 KB

图片1.png

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2018-3-10 21:18:50
#上下调比例条形图
#info1<-read.table("E:/crispr_program/split_cell_lines/feature/aa.txt",sep = "\t",header = T,row.names = 1)
info1<-read.table("E:/crispr_program/data_crispr/onco.expression11.txt",sep = "\t",header = T,row.names = 1)
info1<-as.matrix(info1)
info1["down_onco",]<- (-1)*info1["down_onco",]  #负数
info1["down_ran",] <- (-1)*info1["down_ran",]   #负数

par(mar=c(18,5,5,10),xpd=T)                     #图片位置调节
posit<-barplot(info1[c("up_onco","up_ran"),],beside=T,ylim=c(-0.2,1),col=c("tomato","gray"),
               border=NA,ylab="Ratio",axisnames=FALSE)
barplot(info1[c("down_onco","down_ran"),],beside = T,add=TRUE,col=c("limegreen","gray"),border=NA, axisnames = FALSE)
legend("topleft",legend = c("up-regulated","down-regulated","random"),border=c("tomato","limegreen","gray"),fill=c("tomato","limegreen","gray"),
       inset=0.025,bty = "n")
#text(posit+3,-0.2,c(  "Stage.I","",        "Stage.II","",        "Stage.IIA","",        "Stage.IIB","",        "Stage.III","",        "Stage.IIIA","",        "Stage.IIIB","",        "Stage.IIIC","",        "Stage.IV",""),cex=0.8,srt=60,pos=2,xpd=TRUE)
text(posit+1.5,-0.35,
     c("Breast carcinoma","","Carcinoma of bladder","","Cervical squamous cell carcinoma","","Colon carcinoma","",
       "Endometrial carcinoma","","Esophageal carinoma","","Glioblastoma","",
       "Liver carcinoma","","Lung adenocarcinoma","","Lung squamous cell carcinoma","","Malignant neoplasm of clon with rectum","",
       "Pancreatic carcinoma","","Pheochromocytoma and paraganglioma","",
       "Renal cell carcinoma","","Squamous","","Stomach carcinoma","","Thyroid carcinoma",""),
     cex=0.7,srt=60,pos=2,xpd=TRUE)
abline(h=0,xpd=FALSE)    #添加Y=0;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群