[R] update'ing trellis object
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Oct 4 22:14:58 CEST 2009
On Sun, Oct 4, 2009 at 3:45 PM, Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
>
> Yes, unfortunately the trellis object cannot distinguish between the
> "legend" and the "key" any more.
>
If you are willing to muck around at the grid level you can do it.
First list out the grid objects using grid.ls(). Now looking for 3
grid text objects in proximity we see 3 such objects as descendants of
GRID.frame.215 and we examine the first one which, GRID.text.218,
which indeed contains setosa in its label. Finally we zap the labels
of those three grid text objects.
> library(grid)
> print(fig)
> grid.ls()
GRID.rect.233
plot1.xlab
plot1.ylab
GRID.segments.234
GRID.segments.235
GRID.text.236
GRID.segments.237
GRID.text.238
GRID.segments.239
GRID.points.240
GRID.points.241
GRID.points.242
GRID.rect.243
GRID.frame.215
GRID.cellGrob.217
GRID.rect.216
GRID.cellGrob.219
GRID.text.218
GRID.cellGrob.221
GRID.text.220
GRID.cellGrob.223
GRID.text.222
GRID.frame.224
GRID.cellGrob.226
GRID.rect.225
GRID.cellGrob.228
GRID.text.227
> str(grid.get("GRID.text.218"))
List of 11
$ label : chr "setosa"
$ x :Class 'unit' atomic [1:1] 0
.. ..- attr(*, "unit")= chr "npc"
.. ..- attr(*, "valid.unit")= int 0
$ y :Class 'unit' atomic [1:1] 0.5
.. ..- attr(*, "unit")= chr "npc"
.. ..- attr(*, "valid.unit")= int 0
$ just : chr "centre"
$ hjust : num 0
$ vjust : NULL
$ rot : num 0
$ check.overlap: logi FALSE
$ name : chr "GRID.text.218"
$ gp :List of 6
..$ col : chr "black"
..$ alpha : num 1
..$ lineheight: num 1
..$ fontface : num 1
..$ cex : num 1
..$ font : int 1
..- attr(*, "class")= chr "gpar"
$ vp : NULL
- attr(*, "class")= chr [1:3] "text" "grob" "gDesc"
> grid.edit("GRID.text.218", label = "")
> grid.edit("GRID.text.220", label = "")
> grid.edit("GRID.text.222", label = "")
More information about the R-help
mailing list