search for: gtree

Displaying 20 results from an estimated 33 matches for "gtree".

Did you mean: tree
2007 Aug 08
1
Help using gPath
Hi everyone,I'm trying to figure out how to use gPath and the documentation is not very helpful :( I have the following plot object: plot-surrounds:: background plot.gTree.378:: background guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347, minor-vertical.segments.349, major-horizontal.segments.351, major-vertical.segments.353) guide.gTree.356:: (background.rect.345, minor-horizontal.segments.347, minor-vertical.segments.349, major-horizontal...
2011 Feb 15
1
gList and gTree methods of grid::grobX
Dear all, In an attempt to draw fill patterns in grid graphics, I have encountered a behavior of grobX that I cannot understand from the documentation. Consider this, library(grid) ## gTree g1 <- gTree(children=gList( rectGrob(0.5,0.5, width=unit(0.8,"npc"), height=unit(2,"cm")), circleGrob(r=0.3)), vp=viewport(0.5,0.5)) ## gList g1 <- gList(rectGrob(0.5,0.5, width=unit(0.8,"npc"),...
2009 Sep 27
0
puzzle with drawDetails for a class derived from a gTree
Dear all, I've tried all sorts of variations discussed in "R graphics" by Paul Murrell, but I still can't understand how to write a drawDetails method for a class derived from a gTree. Below is a minimal, dummy example where two strings are plotted in two separate viewports. I require the creation of the strings to be evaluated inside the drawDetails function because my real example will need to calculate a grob size on-the-fly (the viewport size as well, for which I have no clu...
2009 May 31
2
grid.edit() for ggplot2
...ically I don't know how to write a syntactically correct gPath), p <- # minimal example qplot(0,0)+ annotate("text",0,0,label="test") g <- # store the plot as a grob ggplotGrob(p) # structure of the grob grid.ls(g) # rather large! # find a particular grob in the gTree getGrob(g,"texts", grep = T) # next step, modify, say, the colour of these grobs grid.edit() # what do I put in here? Thanks for any piece of advice, baptiste
2005 Oct 03
1
Grid: constructing a gTree with grobs that use named viewports from a vpTree
...tom 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 'tl' was not found presumably because no equivalent of the upViewport(1) command is used. What should I be doing here? Thanks, Hadley
2007 Dec 18
1
ggplot2 - getting at the grobs
...I continue trying to get several of my plotting functions to use ggplot, because I really do like the concept of the graphical objects, and working with them in the abstract. I am now trying to access the grobs to manipulate using grid. However, until now all I managed was to get the plot as a gTree object, and manipulate it as a gTree from there. The problem is that then it is no longer a ggplot, and thus I can no longer use the ggplot functions. How to get at the grobs, without converting the ggplot into a gTree? Thanks, Pedro
2009 Sep 19
1
matrix operations on grobs and grid units
..., name=paste("cells-label-r",ii, "-c",jj,sep="")) gcells = placeGrob(gcells, text.grob.ij, row=jj, col=ii) label.ind <- label.ind + 1 } } gList( gcells) } # tests vp = viewport(name="cells") grid.draw(gTree(children=makeTableGrobs(e), childrenvp=vp)) grid.newpage() grid.draw(gTree(children=makeTableGrobs(e, 1, 4), childrenvp=vp)) grid.newpage() grid.draw(gTree(children=makeTableGrobs(e, 4, 1), childrenvp=vp)) This works as expected, however I would like some advice before going any further, - becaus...
2009 Jun 26
1
gradient fill of a grid.polygon
...thought was to rotate the grob (triangle here), paint it with the gradient, and plot the result in a rotated viewport with opposite rotation angle. I'm still hopeful it might work, but see 3). 3) each stripe is directly plotted, as opposed to saved as a grob. I tried to use either a gList or a gTree to store the output of the for loop, but I didn't understand why the result wouldn't appear on screen with grid.draw. What's the best structure to hold together these different slices? It is presumably this object that I should be plotting eventually in the right orientation. Sorry fo...
2012 Apr 13
0
Reference Class import() behaviour
...view = function() { print(vps) print(gt) print(nums) })) b.gen <- setRefClass("classB", contains = "classA") library(grid) my.vps <- vpTree(viewport(name = "parent"), vpList(viewport(name = "child"))) my.gtree <- gTree(name = "tree", children = gList(rectGrob(vp = "parent"), textGrob("test", vp = "child"))) a <- a.gen$new(vps = my.vps, gt = my.gtree, nums = 11:20) b <- b.gen$new() a$view() b$view() # Ev...
2011 Sep 30
0
Warning messages upon new package loading
...ough, so I am wondering how to get rid of the warnings. Warning messages: 1: Class "frame" is defined (with package slot 'kiwixposepreprod') but no metadata object found to revise superClass information---not exported? Making a copy in package '.GlobalEnv' 2: Class "gTree" is defined (with package slot 'kiwixposepreprod') but no metadata object found to revise superClass information---not exported? Making a copy in package '.GlobalEnv' 3: Class "grob" is defined (with package slot 'kiwixposepreprod') but no metadata object fou...
2010 Aug 11
2
help to polish plot in ggplot2
Hi, I wanted to generate a plot which is almost like the plot generated by the following codes. category <- paste("Geographical Category", 1:10) grp1 <- rnorm(10, mean=10, sd=10) grp2 <- rnorm(10, mean=20, sd=10) grp3 <- rnorm(10, mean=15, sd=10) grp4 <- rnorm(10, mean=12, sd=10) mydat <- data.frame(category,grp1,grp2,grp3,grp4) dat.m <- melt(mydat) p <-
2008 Sep 29
2
ggplot 2 - editing in the "panel_1_1" viewport
...rel http://www.nabble.com/navigating-ggplot-viewports-tt14826352.html#a15056223. I tried it, and it works. However, I am trying to develop some functions that will do the drawing "automatically", and usually I will not know the full name of the grob that has the layout vp, like "plot.gtree.76". Is there a way that I can repeat the same process, without going through the grid.ls step? Thanks, Pedro -- View this message in context: http://www.nabble.com/ggplot-2---editing-in-the-%22panel_1_1%22-viewport-tp19726397p19726397.html Sent from the R help mailing list archive at Nabble...
2011 Apr 26
2
grid stringHeight
Dear all, I'm puzzled by the behavior of stringHeight in the grid package. Consider the following test, library(grid) test <- function(lab="dog", ...){ g1 <- textGrob(lab) g2 <- rectGrob(height=grobHeight(g1), width=grobWidth(g1)) gg <- gTree(children=gList(g1,g2), ...) print(c("height:", convertUnit(stringHeight(lab), "mm", "y"))) grid.draw(gg) } grid.newpage() test() test(expression(dog), vp=viewport(x=0.6)) ## notice how the dog's tail is being cut off, where ## expression yields a snug cage g...
2005 Oct 03
2
grob questions
If I run the following example from: http://www.stat.auckland.ac.nz/~paul/grid/doc/grobs.pdf > grid.newpage() > pushViewport(viewport(w = 0.5, h = 0.5)) > myplot <- gTree(name = "myplot", children = gList(rectGrob(name = "box", + gp = gpar(col = "grey")), xaxisGrob(name = "xaxis"))) > grid.draw(myplot) > grid.edit("myplot::xaxis", at = 1:10/11) > grid.edit("myplot::xaxis::labels", label = round(1:1...
2010 Mar 19
2
lattice grob
Dear list, I'm trying to arrange various grid objects on a page using a frameGrob. It works fine with basic grobs (textGrob, gTree, etc.), and also with ggplot2 objects using the ggplotGrob() function. I am however stuck with lattice. As far as I understand, lattice produces a list of class trellis, which is eventually displayed using the plot.trellis method. I am not sure if/how one can convert this list into a high-level gro...
2006 Jul 29
3
placing rectangle behind plot
I am trying to create a lattice plot and would like to later, i.e. after the plot is drawn, add a grey rectangle behind a portion of it. The following works except that the rectrangle is on top of and obscures a portion of the chart. I also tried adding col = "transparent" to the gpar list but that did not help -- I am on windows and perhaps the windows device does not support
2008 Jul 09
1
childNames for xaxis grob (grid package)
Dear list, 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") c...
2009 May 21
1
size of point symbols
...issing something obvious. I don't understand the rationale in the absolute sizes of the point symbols, and I couldn't find it documented. The example below uses Grid to check the size of the symbols against a square of 10mm x 10mm. > checkOneSymbol <- function(pch=0){ > gTree(children=gList( > rectGrob(0.5, 0.5, width=unit(10, "mm"), height=unit(10, > "mm"), > gp=gpar(lty=2, fill=NA, col=alpha("black", 0.5))), > pointsGrob(0.5, 0.5, size=unit(10, "mm"),pch=pch, > gp=gpar(col=alp...
2009 May 21
1
size of point symbols
...issing something obvious. I don't understand the rationale in the absolute sizes of the point symbols, and I couldn't find it documented. The example below uses Grid to check the size of the symbols against a square of 10mm x 10mm. > checkOneSymbol <- function(pch=0){ > gTree(children=gList( > rectGrob(0.5, 0.5, width=unit(10, "mm"), height=unit(10, > "mm"), > gp=gpar(lty=2, fill=NA, col=alpha("black", 0.5))), > pointsGrob(0.5, 0.5, size=unit(10, "mm"),pch=pch, > gp=gpar(col=alp...
2012 Mar 16
1
ggmap crash
...olate) 2: drawDetails.rastergrob(x, recording = FALSE) 3: drawDetails(x, recording = FALSE) 4: drawGrob(x) 5: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid")) 6: grid.draw.grob(x$children[[i]], recording = FALSE) 7: grid.draw(x$children[[i]], recording = FALSE) 8: drawGTree(x) 9: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) 10: grid.draw.gTree(x$children[[i]], recording = FALSE) 11: grid.draw(x$children[[i]], recording = FALSE) 12: drawGTree(x) 13: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) 14: grid.draw.gTr...