如何在r中跨越多个页面上的图像?
我试图生成一个绘图,但我需要在多个页面上跨越图像如何在r中跨越多个页面上的图像?,r,plot,R,Plot,我试图生成一个绘图,但我需要在多个页面上跨越图像 pdf(file = ("Rplot%03d.pdf"), onefile=FALSE) height<-100 plot(-1,-1,xlim=c(0,50),ylim=c(0,height),axes=F,ann = FALSE) for (i in 1:100) { rect(0, height, 10, height+.15, col="red", border = "black") rect(11, h
pdf(file = ("Rplot%03d.pdf"), onefile=FALSE)
height<-100
plot(-1,-1,xlim=c(0,50),ylim=c(0,height),axes=F,ann = FALSE)
for (i in 1:100)
{
rect(0, height, 10, height+.15, col="red", border = "black")
rect(11, height, 40, height+.15, col="green", border = "black")
rect(41, height, 50, height+.15, col="blue", border = "black")
height<-height-1
}
axis(3,at=c(,0,10,20,30,40,50),cex.axis=.3,las=2)
dev.off()
第2页:
Scale
rectangular bar (with three different color)
rectangular bar (with three different color)
....... (7 times)
.......
rectangular bar (with three different color)
第3页:
Scale
rectangular bar (with three different color)
rectangular bar (with three different color)
....... (7 times)
.......
rectangular bar (with three different color)
你不能;PDF中的每个“页面”都是一个单独且完整的绘图。实现所需功能的唯一方法是使用相同的ylim
对plot()
执行多个调用,并且只使用足够的x数据绘制10个条形图。要实现这一点,您需要将数据集分割成10个条的块,并将每个绘图作为外部for()
循环的一部分启动
Scale
rectangular bar (with three different color)
rectangular bar (with three different color)
....... (7 times)
.......
rectangular bar (with three different color)