search for: plotviewport

Displaying 13 results from an estimated 13 matches for "plotviewport".

2009 Jul 21
2
animated grid graphics
I need to make a fairly complex animated graphic and decided to use grid for it. A very simple example of what I need: ##============================================================================== library(grid) grid.newpage() pushViewport(plotViewport()) pushViewport(viewport(xscale = extendrange(c(0, 100)), yscale = extendrange(c(0, 100)))) grid.xaxis() grid.yaxis() rectNames <- paste("r", 1:100, sep = "") for (i in 1:100) { grid.rect(x = unit(sample(0:100, 1), "native"), y =...
2011 Apr 28
2
gridBase Base Plot Positioning
...ffort. Can someone explain how to keep the column of boxplots on the same page as the rectangles (even though I've tried new = TRUE) ? Also, would it be hard / possible to match up the middle of each boxplot to the middle of each rectangle ? pdf("tmp.pdf", h = 6, w = 10) pushViewport(plotViewport(c(5, 5, 4, 2))) pushViewport(viewport(layout = grid.layout(4, 6))) for(i in 1:5) { for(i2 in 1:4) { pushViewport(viewport(layout.pos.row = i2, layout.pos.col = i)) grid.rect() popViewport() } } pushViewport(viewport(layout.pos.col = 6)) plot.new() par(plt = gridP...
2008 Jul 09
1
childNames for xaxis grob (grid package)
...ist, Can someone explain why the childNames below gives character(0) instead of the (canonical) names of the children grobs of the xaxis gTree ? [1] "major" "ticks" "labels" Many thanks in advance, Tobias ### minimal example code ### library(grid) pushViewport(plotViewport(c(5,4,4,2))) pushViewport(dataViewport(1:5, 1:5)) grid.points(1:5, 1:5) grid.xaxis(name = "xa") grid.get("xa") childNames(grid.get("xa")) ### sessionInfo() ### > sessionInfo() R version 2.7.1 (2008-06-23) i486-pc-linux-gnu locale: en_US.UTF-8 attached base pack...
2011 Aug 18
1
Where are the ticks on grid.xaxis?
...usually not a trivial task; the default behavior of these functions seems to work well. The problem with this strategy is that I cannot figure out how to "recover" the positions of these ticks when you do NOT specify the 'at' argument. For example: grid.newpage() pushViewport(plotViewport(c(5, 4, 2, 2), name = "myvp")) # This draws a default xaxis a = grid.xaxis(name = "myX") # What are the tick marks? grid.get("myX")$at # NULL # But if I specify an 'at' argument... grid.edit("myX", at = seq(0, 1, length = 10)) # ...I can get at the...
2011 May 14
1
Using dates on axis with Grid plots
...eral years of data so I would like to be able to have labeled tick marks only intermittently (not one per date). I can transform the initial data from a date time string into POSIXlt or POSIXct, or Date objects. The issue is that when I try to layout the plot using: dev.off() pushViewport( plotViewport( c(5, 5, 4, 2), xscale=c( min(foo), max(foo)), yscale=c(0,30) ) ) I get this error, regardless of whether "foo" is formated as POSIXlt, POSIXct or Date for the xscale. Error in valid.viewport(x, y, width, height, just, gp, clip, xscale,...
2008 Jan 14
2
Need help with xspline error message in R 2.6.1 on Windows XP
...pe, x$open, x$arrow, : add_point - reached MAXNUMPTS (25200) This is the code that generates this error. plot.results <- function(dfn) { dt <- read.table(dfn) shp <- rep(1, as.numeric(length(dt$year))) shp[1] <- shp[as.numeric(length(dt$year))] <- 0 grid.rect() pushViewport(plotViewport(c(5.1, 4.1, 4.1, 2.1))) pushViewport(dataViewport(dt$year, dt$mean)) grid.rect() grid.xaxis() grid.yaxis() grid.points(dt$year, dt$mean, pch=16) grid.xspline(dt$year, dt$mean, shape=shp, open=TRUE, gp=gpar(col="red")) popViewport(2) } plot.results("section01_model_results.dat...
2011 Sep 09
1
Rgl and plotmath symbols (via sprites): a trial
...- require(rgl) require(grid) s <- seq(0, 1, length.out=21) M <- function(u) apply(u, 1, min) u <- s v <- s z <- outer(u, v, function(u,v) M(cbind(u,v))) ## create z-axis label png("zlabel.png", bg="transparent", width=70, height=70) grid.newpage() pushViewport(plotViewport(c(1,1,1,1))) print(grid.text(expression(W(u[1],u[2])==c),rot=90)) popViewport() dev.off() ## plot persp3d(u, v, z, aspect="iso", front="line", lit=FALSE, axes=FALSE, xlab="", ylab="", zlab="") axes3d(edges=c('x--','y--',...
2009 Oct 27
0
boxplot using grid
...ines(c(unit(0.25, "npc"), unit(0.75, "npc")), rep(unit(bxp$stats[3], "native"), 2), gp = gpar(lwd = 2), name = "median" ) if(On != 0){ grid.points(x = rep(unit(0.5, "npc")), y = O) } } # Code run x <- rnorm(100) pushViewport(plotViewport()) pushViewport(dataViewport(yData = x, xscale = c(0, 1))) grid.yaxis() bxplt(x) Additionally, some people might be wondering why I am reimplementing the bocplo using grid. The reason is that I need to annotate the plot with something a little more elegant than arrows... I wrote the following func...
2002 Nov 27
2
grid package and lines
Hello list, When using the grid package in R 1.60 under windows grid.lines and grid.line.to seem not to use the coordinate system as defined by the current viewport whereas grin.points does. Am I doing something wrong? Sten -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send
2010 Aug 28
9
How to define new matrix based on an elementary row operation in a single step?
-- View this message in context: http://r.789695.n4.nabble.com/How-to-define-new-matrix-based-on-an-elementary-row-operation-in-a-single-step-tp2341768p2341768.html Sent from the R help mailing list archive at Nabble.com.
2002 Jun 07
2
offset labeling boxplots
Hello everybody, often I plot boxplots with different number of boxes (up to 200 boxes). I'd like to give every box a readable label on the x-axis. Therefore, I decrease the fontsize of the names and plot them vertical. But if you zoom into the plot (pdf) you will find an offset between the tickmark and the label - the label is shifted to the right. If you vary the box.count in the
2005 Apr 18
1
R-2.1.0 is released
...#39;gamma' gpar has been deprecated (this is a device property not a property of graphical objects; suggested by Ross Ihaka). - New 'lex' gpar; a line width multiplier. - grid.text() now handles any language object as mathematical annotation (instead of just expressions). - plotViewport() has default value for 'margins' argument (that match the default value for par(mar)). - The 'extension' argument to dataViewport() can now be vector, in which case the first value is used to extend the xscale and the second value is used to extend the y scale. (sugge...
2005 Apr 18
1
R-2.1.0 is released
...#39;gamma' gpar has been deprecated (this is a device property not a property of graphical objects; suggested by Ross Ihaka). - New 'lex' gpar; a line width multiplier. - grid.text() now handles any language object as mathematical annotation (instead of just expressions). - plotViewport() has default value for 'margins' argument (that match the default value for par(mar)). - The 'extension' argument to dataViewport() can now be vector, in which case the first value is used to extend the xscale and the second value is used to extend the y scale. (sugge...