[R] update'ing trellis object

Sebastian P. Luque spluque at gmail.com
Sun Oct 4 23:03:33 CEST 2009

On Sun, 4 Oct 2009 16:14:58 -0400,
Gabor Grothendieck <ggrothendieck at gmail.com> wrote:

> 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.


Thanks everyone.  Besides Gabor's grid approach, another option, short
of redoing the plot entirely, would be to simply target the list element
to remove:

fig$legend[[2]] <- NULL

I don't know if the index (2) would be constant for any such plot



More information about the R-help mailing list