search for: upviewport

Displaying 20 results from an estimated 52 matches for "upviewport".

2008 Aug 08
2
gridBase and new.page() / grid.newpage()
...)) par(plt = gridPLT(), new = TRUE) grid.rect(gp=gpar(fill="light grey")) dens <- density(rnorm(10)) plot.density(dens, axes = FALSE, mar = c(0,0,0,0), main = "", xlab = "", ylab = "") upViewport() } pushViewport(viewport(xscale = c(0, 1), layout.pos.col = 1)) grid.rect(gp=gpar(fill="grey")) grid.points() upViewport() upViewport() } myplot() myplot() pdf() myplot() myplot() dev.off()
2005 May 31
2
Problem going back to a viewport with gridBase
...quot;null","null")) pushViewport(viewport(layout = grid.layout(1, 2, widths = unit.))) # draw green graph in first column (viewport A) pushViewport(viewport(layout.pos.col = 1, name = "A")) par(fig = gridFIG()); par(new = TRUE) plot(1:10, col = "green", pch = 20) upViewport(1) # draw purple graph in second column (viewport B) pushViewport(viewport(layout.pos.col = 2, name = "B")) par(fig = gridFIG()); par(new = TRUE) plot(1:100, col = "purple", pch = 18) upViewport() # go back to A and add horizontal grid lines seekViewport("A") par(fig...
2005 May 31
2
Problem going back to a viewport with gridBase
...quot;null","null")) pushViewport(viewport(layout = grid.layout(1, 2, widths = unit.))) # draw green graph in first column (viewport A) pushViewport(viewport(layout.pos.col = 1, name = "A")) par(fig = gridFIG()); par(new = TRUE) plot(1:10, col = "green", pch = 20) upViewport(1) # draw purple graph in second column (viewport B) pushViewport(viewport(layout.pos.col = 2, name = "B")) par(fig = gridFIG()); par(new = TRUE) plot(1:100, col = "purple", pch = 18) upViewport() # go back to A and add horizontal grid lines seekViewport("A") par(fig...
2006 May 21
1
print.trellis(..., draw.in=...)
...in 2.2.1 and 2.3.0 patched. library(grid) library(lattice) pushLayout <- function(nr, nc, name="layout") { pushViewport(viewport(layout=grid.layout(nr, nc), name=name)) for (i in 1:nr) { for (j in 1:nc) { pushViewport(viewport(layout.pos.row=i, layout.pos.col=j)) upViewport() } } upViewport() } names.vpPath <- names.viewport <- function(x) x$name with.vpPath <- with.viewport <- function(data, expr, ...) { # if data is a vpPath it cannot be ROOT since # NULL will never dispatch here depth <- if (data$name == "ROOT")...
2012 Oct 19
1
grid(Base): How to avoid "Figure region too small and/or viewport too large" by specifying 'relative' units?
...'graphics' plot plot(range(1:n), yran, type="n", ann=FALSE, axes=FALSE) # set up coordinate axes points(1:n, x[i,j,], type="b") # actual plot grid.rect() ## axes if(i==nx) axis(1) # x axis if(j==1) axis(2) # y axes upViewport() ## column labels if(i==1){ pushViewport(viewport(layout.pos.row=1, layout.pos.col=j.)) grid.rect() grid.text(t[j], x=0.5, y=0.5) upViewport() } ## row labels if(j==2){ pushViewport(viewport(layou...
2008 Dec 01
2
align two lattice plots with grid
...eights=unit(c(3, 2), "inches")))) > > pushViewport(viewport(layout.pos.col=1, layout.pos.row=1, > just="center", > name = "top")) > > print(p1, newpage=F, panel.width=list(4, "inches"), > panel.height=list(2.5, "inches")) > upViewport() > pushViewport(viewport(layout.pos.col=1, layout.pos.row=2, > just="center", > name = "bottom")) > > print(p2, newpage=F, panel.width=list(4, "inches"), > panel.height=list(1.5, "inches")) > upViewport() Any help would be greatly ap...
2005 Oct 03
1
Grid: constructing a gTree with grobs that use named viewports from a vpTree
....pos.col = 2, layout.pos.row=2, name="br") ) ) grobs <- gList( rectGrob(vp="tl"), textGrob("Top left", vp="tl"), textGrob("Bottom right", vp="br") ) I can draw the grobs using the following code: grid.newpage() pushViewport(vp) upViewport(1) grid.draw(grobs) But I want a grob that represents those grobs drawn in the appropriate viewports. I had hoped I could do something like: grid.newpage() grid.draw(gTree(vp=vp, children = grobs)) But I get: Error in downViewport.vpPath(vp, strict = TRUE, recording = FALSE) : Viewport '...
2007 Sep 08
1
ggplot legend consolidation
...data(mtcars) grid.newpage() pushViewport(viewport(layout = grid.layout(2, 2))) p <- ggplot(data = mtcars) + geom_point(mapping = aes(x = hp, y = mpg, colour = cyl)) pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1)) print(p, vp = current.viewport()) upViewport() p <- ggplot(data = mtcars) + geom_point(mapping = aes(x = drat, y = disp, colour = cyl)) pushViewport(viewport(layout.pos.col = 2, layout.pos.row = 1)) print(p, vp = current.viewport()) upViewport() p <- ggplot(data = mtcars) + geom_point(mapping = aes(x =...
2008 Oct 27
3
Arrays of Trellis plots
hello, the example below does not work. (i know it's not supposed, but it makes it clear what i'm trying to achieve) par(mfrow=c(2,1)) xyplot(y~x2|x1,data=dataframe1,pch=20) xyplot(y~x2|x1,data=dataframe2,pch=20) i know i could probably merge the two datasets and do something like xyplot(y~x2|x1+dataset,data=merged) any other suggestion? thanks. [[alternative HTML version deleted]]
2012 Sep 23
1
Background color in a grid plot seems to interfere with plot()
...ground par(plt=gridPLT()) ## plot plot(1:10, 1:10, log="y", xlab="", ylab="", xaxt=if(i==2) "s" else "n", yaxt=if(j==1) "s" else "n") par(new=TRUE) # to be run after first plot upViewport() } } par(par.) dev.off()
2011 Jul 01
1
beginner question - effective way to chart sleep habits
Hi - beginning R user question here - each day, over the course of several months, I've tracked the time I go to bed, the time I wake up, and my hours spent sleeping. What would be a good way to display this information? I think it would be ideal to show something resembling a bar and whisker graph for each day that would show the interval of hours spent asleep (or perhaps just a bar
2005 Oct 11
1
aligning column of xyplots and removing space between them
...lis.par.set(theme = col.whitebg()) grid.newpage() pushLayout <- function(nr, nc, ..., name="layout") { pushViewport(viewport(layout=grid.layout(nr, nc, ...), name=name)) for (i in 1:nr) { for (j in 1:nc) { pushViewport(viewport(layout.pos.row=i, layout.pos.col=j)) upViewport() } } upViewport() } with.vpPath <- with.viewport <- function(data, expr, ...) { # if data is a vpPath it cannot be ROOT since NULL will not dispatch here depth <- if (data$name == "ROOT") 0 else downViewport(data$name) result <- eval.parent(substitu...
2007 Jun 28
1
Changing graphics height when using grid and lattice
...quot;, key = list(text = list("")) ) grid.newpage() pushViewport(viewport(layout = grid.layout(2, 1, heights = unit(c(1, 6), "null")))) pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1)) grid.text("Analysis of Relative Risks of various Adverse Events") upViewport() pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 2)) ### Change the relative width of the 2 presented graphics pushViewport(viewport(layout = grid.layout(1, 2, unit(c(relativeWidth, 1), "null")))) pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1)) print(plot1,...
2011 Oct 31
1
Help combining cell labelling and multiple mosaic plots
...hen I take out the pop=FALSE commands in the mosaic commands and comment out the two lines labelling the cells, then the plots are laid out exactly as I'd like: side-by-side. But I do require the cell labelling and the pop=FALSE arguments. I suspect I need to add in a call to pushViewport or an upViewport command, but I'm not sure. Any advice is welcome. library(vcd) library(grid) .test<-as.table(matrix(c(1, 2, 3, 4, 5, 6), nrow=3, ncol=2, byrow=TRUE)) .test<-prop.table(.test, 1) .test1<-as.table(matrix(c(1, 2, 3, 4), nrow=2, ncol=2, byrow=TRUE)) .test1...
2006 Jun 12
1
strange behaviour with rotated viewports in grid
...behaviour. The following example illustrates this issue. I would appreciate if anyone has a way to solve this. Best regards, r. pushViewport(viewport(width=0.9,height=0.9,name="vp1")) grid.rect() pushViewport(viewport(width=0.3,height=0.9,angle=0,name="vp2")) grid.rect() upViewport() pushViewport(viewport(width=0.3,height=0.9,angle=10,name="vp3")) grid.rect() Dr. Rafael Najmanovich European Bioinformatics Institute Wellcome Trust Genome Campus Cambridge CB10 1SD United Kingdom rafael.najmanovich at ebi.ac.uk - www.ebi.ac.uk/~rafi +44-1223-492599 (voice) +44-7786-...
2006 Sep 09
1
How to rotate any plot in R
Dear all R users, I am wondering whether it is possible in R to rotate any plot like Histogram, scatter plot, correlogram etc along with their legend, comments etc. Thanks and regrads, stat --------------------------------- Find out what India is talking about on - Yahoo! Answers India [[alternative HTML version deleted]]
2008 Nov 01
1
Splitting device for ggplots?
Dear UseRs, For various reasons I need to plot multiple ggplots on one device (preferably pdf). Is there a way to achieve that? par(mfrow), split.screen() and layout() seem not to do the job. Thanks, Vitalie.
2011 May 01
1
multiple mosaic plots layout
I would like to display multiple mosaic plots from vcd (not defined by a model but derived from different data sets) side by side. Neither par(mfrow=...) nor layout seem to allow to arrange multiple mosaic plots in a grid. Is there an easy way of arranging mosaics in a grid?
2008 Nov 20
0
align two lattice plots using grid
...es"), heights=unit(c(3, 2), "inches")))) pushViewport(viewport(layout.pos.col=1, layout.pos.row=1, just="center", name = "top")) print(p1, newpage=F, panel.width=list(4, "inches"), panel.height=list(2.5, "inches")) upViewport() pushViewport(viewport(layout.pos.col=1, layout.pos.row=2, just="center", name = "bottom")) print(p2, newpage=F, panel.width=list(4, "inches"), panel.height=list(1.5, "inches")) upViewport() I'm sure there is a clever trick to get the panels to be al...
2009 Feb 11
1
Help with XYPLOT with marginal histograms
...unit(0.2,"npc"), just=c("left","bottom"), x=unit(0.8,"npc"), y=unit(0.8,"npc"), angle=-90, name="v3" ) pushViewport(v1) grid.rect() print( xyplot( NOx ~ E, data=ethanol, ), newpage=FALSE ) upViewport(); pushViewport(v2) grid.rect() print(histogram( ethanol$E ),newpage=FALSE) upViewport() pushViewport(v3) grid.rect() print( histogram( ethanol$NOx ) , newpage=FALSE ) [[alternative HTML version deleted]]