Gviz output extra empty page on pdf device
1
0
Entering edit mode
Dan Du ▴ 210
@dan-du-5270
Last seen 11 months ago
Germany
Hi Florian and others, I have been testing some functions and parameters, and noticed something odd when plotting tracks on a pdf device (postscript turns out fine), this only happens to some recent R-devel versions (tested on three r-devel builds Feb.3, Feb.14 and Feb.18), apparently the build machine in Seattle is not yet affected, which has a devel build on Jan.15. This happens to the most recent devel version of Gviz 1.7.7. Here is an example, can't really figure it why, ######################################### # say using the 1st example of plotTracks, I will get one empty page before the real deal. ######################################### pdf('test.Gviz.pdf') #postscript('test.Gviz.eps', fonts='sans') # this is ok... st <- c(2000000, 2070000, 2100000, 2160000) ed <- c(2050000, 2130000, 2150000, 2170000) str <- c("-", "+", "-", "-") gr <- c("Group1","Group2","Group1", "Group3") annTrack <- AnnotationTrack(start=st, end=ed, strand=str, chromosome=7, genome="hg19", feature="test", group=gr, id=paste("annTrack item", 1:4), name="annotation track foo", stacking="squish") ax <- GenomeAxisTrack() dt <- DataTrack(start=seq(min(st), max(ed), len=10), width=18000, data=matrix(runif(40), nrow=4), genome="hg19", chromosome=7, type="histogram", name="data track bar") ## Now plot the tracks res <- plotTracks(list(ax, annTrack, dt)) dev.off() ######################################### ######################################### # while it turns out fine for a normal multipage grid viewport, say the viewport clipping example of viewport() ######################################### pdf('test.viewport.pdf') clip.demo <- function(i, j, clip1, clip2) { pushViewport(viewport(layout.pos.col=i, layout.pos.row=j)) pushViewport(viewport(width=0.6, height=0.6, clip=clip1)) grid.rect(gp=gpar(fill="white")) grid.circle(r=0.55, gp=gpar(col="red", fill="pink")) popViewport() pushViewport(viewport(width=0.6, height=0.6, clip=clip2)) grid.polygon(x=c(0.5, 1.1, 0.6, 1.1, 0.5, -0.1, 0.4, -0.1), y=c(0.6, 1.1, 0.5, -0.1, 0.4, -0.1, 0.5, 1.1), gp=gpar(col="blue", fill="light blue")) popViewport(2) } grid.newpage() grid.rect(gp=gpar(fill="grey")) pushViewport(viewport(layout=grid.layout(2, 2))) clip.demo(1, 1, FALSE, FALSE) clip.demo(1, 2, TRUE, FALSE) clip.demo(2, 1, FALSE, TRUE) clip.demo(2, 2, TRUE, TRUE) popViewport() # Demonstrate turning clipping off grid.newpage() pushViewport(viewport(w=.5, h=.5, clip="on")) grid.rect() grid.circle(r=.6, gp=gpar(lwd=10)) pushViewport(viewport(clip="inherit")) grid.circle(r=.6, gp=gpar(lwd=5, col="grey")) pushViewport(viewport(clip="off")) grid.circle(r=.6) popViewport(3) # Demonstrate vpList, vpStack, and vpTree grid.newpage() tree <- vpTree(viewport(w=0.8, h=0.8, name="A"), vpList(vpStack(viewport(x=0.1, y=0.1, w=0.5, h=0.5, just=c("left", "bottom"), name="B"), viewport(x=0.1, y=0.1, w=0.5, h=0.5, just=c("left", "bottom"), name="C"), viewport(x=0.1, y=0.1, w=0.5, h=0.5, just=c("left", "bottom"), name="D")), viewport(x=0.5, w=0.4, h=0.9, just="left", name="E"))) pushViewport(tree) for (i in LETTERS[1:5]) { seekViewport(i) grid.rect() grid.text(current.vpTree(FALSE), x=unit(1, "mm"), y=unit(1, "npc") - unit(1, "mm"), just=c("left", "top"), gp=gpar(fontsize=8)) } dev.off() ######################################### I found that there has been a bug fix introduced in R-devel on Feb 2, not sure if this is the cause. Also noticed some very recent commit (r65013) to r-devel, will see if this changes anything. # R-devel news "Bug fix for pushing viewports in ?grid? (reported by JJ Allaire and Kevin Ushey). NOTE for anyone poking around within the graphics engine display list (despite the warnings not to) that this changes what is recorded by ?grid? on the graphics engine display list." # R-devel svn log r64901 | murrell | 2014-01-31 00:45:44 +0100 (Fri, 31 Jan 2014) | 1 line Changed paths: M /trunk/doc/NEWS.Rd M /trunk/src/library/grid/R/grid.R M /trunk/src/library/grid/R/util.R M /trunk/src/library/grid/R/viewport.R M /trunk/src/library/grid/inst/doc/changes.txt M /trunk/src/library/grid/src/grid.c M /trunk/src/library/grid/src/grid.h bug fix for pushing grid viewports (only record viewport, NOT pushedvp, on graphics engine display list) Best regards, Dan
Gviz Gviz • 2.0k views
ADD COMMENT
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.3 years ago
Switzerland
Hi Dan, Thanks for the heads up. I think this issue is resolved in the latest development version (1.7.8) At least on the build machines in Seattle the vignette has been built properly. Florian On 2/19/14 5:04 PM, "Dan Du" <tooyoung at="" gmail.com=""> wrote: >Hi Florian and others, > >I have been testing some functions and parameters, and noticed something >odd when plotting tracks on a pdf device (postscript turns out fine), >this only happens to some recent R-devel versions (tested on three >r-devel builds Feb.3, Feb.14 and Feb.18), apparently the build machine >in Seattle is not yet affected, which has a devel build on Jan.15. This >happens to the most recent devel version of Gviz 1.7.7. > >Here is an example, can't really figure it why, >######################################### ># say using the 1st example of plotTracks, I will get one empty page >before the real deal. >######################################### >pdf('test.Gviz.pdf') >#postscript('test.Gviz.eps', fonts='sans') # this is ok... >st <- c(2000000, 2070000, 2100000, 2160000) >ed <- c(2050000, 2130000, 2150000, 2170000) >str <- c("-", "+", "-", "-") >gr <- c("Group1","Group2","Group1", "Group3") >annTrack <- AnnotationTrack(start=st, end=ed, strand=str, chromosome=7, > genome="hg19", feature="test", group=gr, > id=paste("annTrack item", 1:4), > name="annotation track foo", > stacking="squish") >ax <- GenomeAxisTrack() >dt <- DataTrack(start=seq(min(st), max(ed), len=10), width=18000, >data=matrix(runif(40), nrow=4), genome="hg19", chromosome=7, >type="histogram", name="data track bar") >## Now plot the tracks >res <- plotTracks(list(ax, annTrack, dt)) >dev.off() >######################################### > >######################################### ># while it turns out fine for a normal multipage grid viewport, say the >viewport clipping example of viewport() >######################################### >pdf('test.viewport.pdf') >clip.demo <- function(i, j, clip1, clip2) { > pushViewport(viewport(layout.pos.col=i, > layout.pos.row=j)) > pushViewport(viewport(width=0.6, height=0.6, clip=clip1)) > grid.rect(gp=gpar(fill="white")) > grid.circle(r=0.55, gp=gpar(col="red", fill="pink")) > popViewport() > pushViewport(viewport(width=0.6, height=0.6, clip=clip2)) > grid.polygon(x=c(0.5, 1.1, 0.6, 1.1, 0.5, -0.1, 0.4, -0.1), > y=c(0.6, 1.1, 0.5, -0.1, 0.4, -0.1, 0.5, 1.1), > gp=gpar(col="blue", fill="light blue")) > popViewport(2) >} > >grid.newpage() >grid.rect(gp=gpar(fill="grey")) >pushViewport(viewport(layout=grid.layout(2, 2))) >clip.demo(1, 1, FALSE, FALSE) >clip.demo(1, 2, TRUE, FALSE) >clip.demo(2, 1, FALSE, TRUE) >clip.demo(2, 2, TRUE, TRUE) >popViewport() ># Demonstrate turning clipping off >grid.newpage() >pushViewport(viewport(w=.5, h=.5, clip="on")) >grid.rect() >grid.circle(r=.6, gp=gpar(lwd=10)) >pushViewport(viewport(clip="inherit")) >grid.circle(r=.6, gp=gpar(lwd=5, col="grey")) >pushViewport(viewport(clip="off")) >grid.circle(r=.6) >popViewport(3) ># Demonstrate vpList, vpStack, and vpTree >grid.newpage() >tree <- vpTree(viewport(w=0.8, h=0.8, name="A"), > vpList(vpStack(viewport(x=0.1, y=0.1, w=0.5, h=0.5, > just=c("left", "bottom"), >name="B"), > viewport(x=0.1, y=0.1, w=0.5, h=0.5, > just=c("left", "bottom"), >name="C"), > viewport(x=0.1, y=0.1, w=0.5, h=0.5, > just=c("left", "bottom"), >name="D")), > viewport(x=0.5, w=0.4, h=0.9, > just="left", name="E"))) >pushViewport(tree) >for (i in LETTERS[1:5]) { > seekViewport(i) > grid.rect() > grid.text(current.vpTree(FALSE), > x=unit(1, "mm"), y=unit(1, "npc") - unit(1, "mm"), > just=c("left", "top"), > gp=gpar(fontsize=8)) >} >dev.off() >######################################### > >I found that there has been a bug fix introduced in R-devel on Feb 2, not >sure if this is the cause. Also noticed some very recent commit (r65013) >to r-devel, will see if this changes anything. > ># R-devel news >"Bug fix for pushing viewports in ?grid? (reported by JJ Allaire and >Kevin Ushey). >NOTE for anyone poking around within the graphics engine display list >(despite the warnings not to) that this changes what is recorded by >?grid? on the graphics engine display list." > ># R-devel svn log >r64901 | murrell | 2014-01-31 00:45:44 +0100 (Fri, 31 Jan 2014) | 1 line >Changed paths: > M /trunk/doc/NEWS.Rd > M /trunk/src/library/grid/R/grid.R > M /trunk/src/library/grid/R/util.R > M /trunk/src/library/grid/R/viewport.R > M /trunk/src/library/grid/inst/doc/changes.txt > M /trunk/src/library/grid/src/grid.c > M /trunk/src/library/grid/src/grid.h > >bug fix for pushing grid viewports (only record viewport, NOT pushedvp, >on graphics engine display list) > >Best regards, >Dan >
ADD COMMENT
0
Entering edit mode
Hi Florian, Thanks for the commit. I also noticed that the new update magically eliminates the empty page. But it leaves me wonder, what is the actual cause... I can see from the svn, there is no real change to the package itself other than the version number bump. And from my test, it seems that it is indeed this version number change and probably the re-installation which did the trick I guess. I think probably it is the way how I handle multiple R-devel versions and how libraries are shared that is causing the problem. Sorry for the noises and any time you have wasted. Best regards, Dan On Mon, 2014-02-24 at 10:55 +0000, Hahne, Florian wrote: > Hi Dan, > Thanks for the heads up. I think this issue is resolved in the latest > development version (1.7.8) > At least on the build machines in Seattle the vignette has been built > properly. > Florian > > On 2/19/14 5:04 PM, "Dan Du" <tooyoung at="" gmail.com=""> wrote: > > >Hi Florian and others, > > > >I have been testing some functions and parameters, and noticed something > >odd when plotting tracks on a pdf device (postscript turns out fine), > >this only happens to some recent R-devel versions (tested on three > >r-devel builds Feb.3, Feb.14 and Feb.18), apparently the build machine > >in Seattle is not yet affected, which has a devel build on Jan.15. This > >happens to the most recent devel version of Gviz 1.7.7. > > > >Here is an example, can't really figure it why, > >######################################### > ># say using the 1st example of plotTracks, I will get one empty page > >before the real deal. > >######################################### > >pdf('test.Gviz.pdf') > >#postscript('test.Gviz.eps', fonts='sans') # this is ok... > >st <- c(2000000, 2070000, 2100000, 2160000) > >ed <- c(2050000, 2130000, 2150000, 2170000) > >str <- c("-", "+", "-", "-") > >gr <- c("Group1","Group2","Group1", "Group3") > >annTrack <- AnnotationTrack(start=st, end=ed, strand=str, chromosome=7, > > genome="hg19", feature="test", group=gr, > > id=paste("annTrack item", 1:4), > > name="annotation track foo", > > stacking="squish") > >ax <- GenomeAxisTrack() > >dt <- DataTrack(start=seq(min(st), max(ed), len=10), width=18000, > >data=matrix(runif(40), nrow=4), genome="hg19", chromosome=7, > >type="histogram", name="data track bar") > >## Now plot the tracks > >res <- plotTracks(list(ax, annTrack, dt)) > >dev.off() > >######################################### > > > >######################################### > ># while it turns out fine for a normal multipage grid viewport, say the > >viewport clipping example of viewport() > >######################################### > >pdf('test.viewport.pdf') > >clip.demo <- function(i, j, clip1, clip2) { > > pushViewport(viewport(layout.pos.col=i, > > layout.pos.row=j)) > > pushViewport(viewport(width=0.6, height=0.6, clip=clip1)) > > grid.rect(gp=gpar(fill="white")) > > grid.circle(r=0.55, gp=gpar(col="red", fill="pink")) > > popViewport() > > pushViewport(viewport(width=0.6, height=0.6, clip=clip2)) > > grid.polygon(x=c(0.5, 1.1, 0.6, 1.1, 0.5, -0.1, 0.4, -0.1), > > y=c(0.6, 1.1, 0.5, -0.1, 0.4, -0.1, 0.5, 1.1), > > gp=gpar(col="blue", fill="light blue")) > > popViewport(2) > >} > > > >grid.newpage() > >grid.rect(gp=gpar(fill="grey")) > >pushViewport(viewport(layout=grid.layout(2, 2))) > >clip.demo(1, 1, FALSE, FALSE) > >clip.demo(1, 2, TRUE, FALSE) > >clip.demo(2, 1, FALSE, TRUE) > >clip.demo(2, 2, TRUE, TRUE) > >popViewport() > ># Demonstrate turning clipping off > >grid.newpage() > >pushViewport(viewport(w=.5, h=.5, clip="on")) > >grid.rect() > >grid.circle(r=.6, gp=gpar(lwd=10)) > >pushViewport(viewport(clip="inherit")) > >grid.circle(r=.6, gp=gpar(lwd=5, col="grey")) > >pushViewport(viewport(clip="off")) > >grid.circle(r=.6) > >popViewport(3) > ># Demonstrate vpList, vpStack, and vpTree > >grid.newpage() > >tree <- vpTree(viewport(w=0.8, h=0.8, name="A"), > > vpList(vpStack(viewport(x=0.1, y=0.1, w=0.5, h=0.5, > > just=c("left", "bottom"), > >name="B"), > > viewport(x=0.1, y=0.1, w=0.5, h=0.5, > > just=c("left", "bottom"), > >name="C"), > > viewport(x=0.1, y=0.1, w=0.5, h=0.5, > > just=c("left", "bottom"), > >name="D")), > > viewport(x=0.5, w=0.4, h=0.9, > > just="left", name="E"))) > >pushViewport(tree) > >for (i in LETTERS[1:5]) { > > seekViewport(i) > > grid.rect() > > grid.text(current.vpTree(FALSE), > > x=unit(1, "mm"), y=unit(1, "npc") - unit(1, "mm"), > > just=c("left", "top"), > > gp=gpar(fontsize=8)) > >} > >dev.off() > >######################################### > > > >I found that there has been a bug fix introduced in R-devel on Feb 2, not > >sure if this is the cause. Also noticed some very recent commit (r65013) > >to r-devel, will see if this changes anything. > > > ># R-devel news > >"Bug fix for pushing viewports in ?grid? (reported by JJ Allaire and > >Kevin Ushey). > >NOTE for anyone poking around within the graphics engine display list > >(despite the warnings not to) that this changes what is recorded by > >?grid? on the graphics engine display list." > > > ># R-devel svn log > >r64901 | murrell | 2014-01-31 00:45:44 +0100 (Fri, 31 Jan 2014) | 1 line > >Changed paths: > > M /trunk/doc/NEWS.Rd > > M /trunk/src/library/grid/R/grid.R > > M /trunk/src/library/grid/R/util.R > > M /trunk/src/library/grid/R/viewport.R > > M /trunk/src/library/grid/inst/doc/changes.txt > > M /trunk/src/library/grid/src/grid.c > > M /trunk/src/library/grid/src/grid.h > > > >bug fix for pushing grid viewports (only record viewport, NOT pushedvp, > >on graphics engine display list) > > > >Best regards, > >Dan > > >
ADD REPLY
0
Entering edit mode
Hi Dan, I introduced a bug in one of the development commits that called grid.newpage() two times instead of only once. I may have fixed that bug in a later commit but forgot to bump the version number, which is the trigger for the build system in Seattle to recompile the package. So I assume that a working version was committed to the svn but not made available via the Bioconductor server. Florian On 2/24/14 3:28 PM, "Dan Du" <tooyoung at="" gmail.com=""> wrote: >Hi Florian, > >Thanks for the commit. I also noticed that the new update magically >eliminates the empty page. > >But it leaves me wonder, what is the actual cause... I can see from the >svn, there is no real change to the package itself other than the >version number bump. And from my test, it seems that it is indeed this >version number change and probably the re-installation which did the >trick I guess. > >I think probably it is the way how I handle multiple R-devel versions >and how libraries are shared that is causing the problem. Sorry for the >noises and any time you have wasted. > >Best regards, >Dan > >On Mon, 2014-02-24 at 10:55 +0000, Hahne, Florian wrote: >> Hi Dan, >> Thanks for the heads up. I think this issue is resolved in the latest >> development version (1.7.8) >> At least on the build machines in Seattle the vignette has been built >> properly. >> Florian >> >> On 2/19/14 5:04 PM, "Dan Du" <tooyoung at="" gmail.com=""> wrote: >> >> >Hi Florian and others, >> > >> >I have been testing some functions and parameters, and noticed >>something >> >odd when plotting tracks on a pdf device (postscript turns out fine), >> >this only happens to some recent R-devel versions (tested on three >> >r-devel builds Feb.3, Feb.14 and Feb.18), apparently the build machine >> >in Seattle is not yet affected, which has a devel build on Jan.15. This >> >happens to the most recent devel version of Gviz 1.7.7. >> > >> >Here is an example, can't really figure it why, >> >######################################### >> ># say using the 1st example of plotTracks, I will get one empty page >> >before the real deal. >> >######################################### >> >pdf('test.Gviz.pdf') >> >#postscript('test.Gviz.eps', fonts='sans') # this is ok... >> >st <- c(2000000, 2070000, 2100000, 2160000) >> >ed <- c(2050000, 2130000, 2150000, 2170000) >> >str <- c("-", "+", "-", "-") >> >gr <- c("Group1","Group2","Group1", "Group3") >> >annTrack <- AnnotationTrack(start=st, end=ed, strand=str, chromosome=7, >> > genome="hg19", feature="test", group=gr, >> > id=paste("annTrack item", 1:4), >> > name="annotation track foo", >> > stacking="squish") >> >ax <- GenomeAxisTrack() >> >dt <- DataTrack(start=seq(min(st), max(ed), len=10), width=18000, >> >data=matrix(runif(40), nrow=4), genome="hg19", chromosome=7, >> >type="histogram", name="data track bar") >> >## Now plot the tracks >> >res <- plotTracks(list(ax, annTrack, dt)) >> >dev.off() >> >######################################### >> > >> >######################################### >> ># while it turns out fine for a normal multipage grid viewport, say the >> >viewport clipping example of viewport() >> >######################################### >> >pdf('test.viewport.pdf') >> >clip.demo <- function(i, j, clip1, clip2) { >> > pushViewport(viewport(layout.pos.col=i, >> > layout.pos.row=j)) >> > pushViewport(viewport(width=0.6, height=0.6, clip=clip1)) >> > grid.rect(gp=gpar(fill="white")) >> > grid.circle(r=0.55, gp=gpar(col="red", fill="pink")) >> > popViewport() >> > pushViewport(viewport(width=0.6, height=0.6, clip=clip2)) >> > grid.polygon(x=c(0.5, 1.1, 0.6, 1.1, 0.5, -0.1, 0.4, -0.1), >> > y=c(0.6, 1.1, 0.5, -0.1, 0.4, -0.1, 0.5, 1.1), >> > gp=gpar(col="blue", fill="light blue")) >> > popViewport(2) >> >} >> > >> >grid.newpage() >> >grid.rect(gp=gpar(fill="grey")) >> >pushViewport(viewport(layout=grid.layout(2, 2))) >> >clip.demo(1, 1, FALSE, FALSE) >> >clip.demo(1, 2, TRUE, FALSE) >> >clip.demo(2, 1, FALSE, TRUE) >> >clip.demo(2, 2, TRUE, TRUE) >> >popViewport() >> ># Demonstrate turning clipping off >> >grid.newpage() >> >pushViewport(viewport(w=.5, h=.5, clip="on")) >> >grid.rect() >> >grid.circle(r=.6, gp=gpar(lwd=10)) >> >pushViewport(viewport(clip="inherit")) >> >grid.circle(r=.6, gp=gpar(lwd=5, col="grey")) >> >pushViewport(viewport(clip="off")) >> >grid.circle(r=.6) >> >popViewport(3) >> ># Demonstrate vpList, vpStack, and vpTree >> >grid.newpage() >> >tree <- vpTree(viewport(w=0.8, h=0.8, name="A"), >> > vpList(vpStack(viewport(x=0.1, y=0.1, w=0.5, h=0.5, >> > just=c("left", "bottom"), >> >name="B"), >> > viewport(x=0.1, y=0.1, w=0.5, h=0.5, >> > just=c("left", "bottom"), >> >name="C"), >> > viewport(x=0.1, y=0.1, w=0.5, h=0.5, >> > just=c("left", "bottom"), >> >name="D")), >> > viewport(x=0.5, w=0.4, h=0.9, >> > just="left", name="E"))) >> >pushViewport(tree) >> >for (i in LETTERS[1:5]) { >> > seekViewport(i) >> > grid.rect() >> > grid.text(current.vpTree(FALSE), >> > x=unit(1, "mm"), y=unit(1, "npc") - unit(1, "mm"), >> > just=c("left", "top"), >> > gp=gpar(fontsize=8)) >> >} >> >dev.off() >> >######################################### >> > >> >I found that there has been a bug fix introduced in R-devel on Feb 2, >>not >> >sure if this is the cause. Also noticed some very recent commit >>(r65013) >> >to r-devel, will see if this changes anything. >> > >> ># R-devel news >> >"Bug fix for pushing viewports in ?grid? (reported by JJ Allaire and >> >Kevin Ushey). >> >NOTE for anyone poking around within the graphics engine display list >> >(despite the warnings not to) that this changes what is recorded by >> >?grid? on the graphics engine display list." >> > >> ># R-devel svn log >> >r64901 | murrell | 2014-01-31 00:45:44 +0100 (Fri, 31 Jan 2014) | 1 >>line >> >Changed paths: >> > M /trunk/doc/NEWS.Rd >> > M /trunk/src/library/grid/R/grid.R >> > M /trunk/src/library/grid/R/util.R >> > M /trunk/src/library/grid/R/viewport.R >> > M /trunk/src/library/grid/inst/doc/changes.txt >> > M /trunk/src/library/grid/src/grid.c >> > M /trunk/src/library/grid/src/grid.h >> > >> >bug fix for pushing grid viewports (only record viewport, NOT pushedvp, >> >on graphics engine display list) >> > >> >Best regards, >> >Dan >> > >> > >
ADD REPLY

Login before adding your answer.

Traffic: 620 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6