Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df0510022237v7b91c484g2cb998321d192d5b@mail.gmail.com>
Date: 2005-10-03T05:37:54Z
From: Gabor Grothendieck
Subject: 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: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.