Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在r中跨越多个页面上的图像?_R_Plot - Fatal编程技术网

如何在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)