双y轴图的绘制

首先配置数据
数据格式如下:
在这里插入图片描述

library(plotrix)
data = read.table("data_A.txt",sep="\t",header=T)
tiff(file="data_A.tiff",width = 15,height = 15,units ="cm",compression="lzw",bg="white",res=300)
xpos<-1:12
twoord.plot(lx=xpos,ly=data$Count,rx=xpos,ry=data$p.adjust,
      ylab="",
      xlab="",rylab="",main="",
	  rylim=c(0,0.08),lylim=c(0,30),type=c('bar','l'),halfwidth=0.2,
     lcol="steelblue",rcol="red",axislab.cex=1.2)
legend("topright",legend=data$Description,cex=0.5)		 
dev.off()

legend是用来专门添加右上角的文本注释的
在这里插入图片描述

发布了28 篇原创文章 · 获赞 22 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43949246/article/details/103996383