Overlap in figures using push viewport

I'm trying to plot two figures onto one PDF, using this code: ncols <- 1 nrows <- 2 grid.newpage() pushViewport(viewport(layout = grid.layout(nrows, ncols))) for (i in seq_along(chroms)) { pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1)) plotTracks(list(itrack, gtrack, dTrack), chromosome = chr1, add = TRUE) pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 2)) plotTracks(list(biomTrack, gtrack2), chromosome = chr1, add = TRUE) popViewport(1) } The problem is, the two figures overlap! (And the row2 of the figure remains empty) I'm hoping fresh eyes will catch my bug. What am I doing wrong? *EDITED TO REFLECT COMMENT FROM @DINRE* ncols <- 1 nrows <- 2 grid.newpage() pushViewport(viewport(layout = grid.layout(nrows, + ncols))) for (i in seq_along(chroms)) { pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1)) plotTracks(list(itrack, gtrack, dTrack), chromosome = chr1, add = TRUE) **popViewport(1)** ## NEED TO POP OUT FIRST ROW BEFORE PLOTTING SECOND. pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 2)) plotTracks(list(biomTrack, gtrack2), chromosome = chr1, add = TRUE) popViewport(1) }
Please make your situation reproducible, i.e. provide us with the data and the code needed to mimic your situation. See stackoverflow.com/questions/5963269/… for more tips on how to do this.

以上就是Overlap in figures using push viewport的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏