On Sat, Oct 3, 2009 at 7:35 PM, David Winsemius <dwinsem...@comcast.net> wrote: > > On Oct 3, 2009, at 7:05 PM, Sebastian P. Luque wrote: > >> Hi, >> >> I thought the following would only remove the legend element of a >> trellis object, but it actually removes both the legend and key >> elements: >> >> ---<--------------------cut >> here---------------start------------------->--- >> fig <- xyplot(Sepal.Length ~ Petal.Length, groups=Species, data=iris, >> key=list(x=1, y=0.02, corner=c(1, 0), size=3, between=1, >> text=list(levels(iris$Species))), >> legend=list(inside=list(fun="draw.key", x=0, y=1, >> corner=c(0, 1), >> args=list(key=list(text=list("a)", cex=1.5)), >> draw=FALSE)))) >> update(fig, legend=NULL) >> ---<--------------------cut >> here---------------end--------------------->--- >> >> Is this the right way to remove an element from the object, using >> update.trellis()? Thanks. >> > It probably depends on the element. In the case of "key", it is a descendant > of the legend list so when you make legend NULL you are wiping out all of > its descendants as well:
Yes, unfortunately the trellis object cannot distinguish between the "legend" and the "key" any more. -Deepayan ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.