[R] grob questions
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Oct 3 07:37:54 CEST 2005
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:10/11, 2))
> grid.edit("myplot::xaxis::labels", y = unit(-1, "lines"))
then
> str(myplot$children$xaxis)
lists 'at' but not the 'labels'.
yet if I do this then the labels are listed:
> xx <- xaxisGrob(name = "myX", at = 1:10)
> childNames(xx)
[1] "major" "ticks" "labels"
1. How do I get to labels in the first case?
2. Is there a better construct than myplot$children$xaxis?
Thanks.
More information about the R-help
mailing list