[R] xyplot without external box
David Winsemius
dwinsemius at comcast.net
Fri Mar 9 18:17:15 CET 2012
On Mar 9, 2012, at 12:10 PM, David Winsemius wrote:
>
> On Mar 8, 2012, at 8:02 AM, Mauricio Zambrano-Bigiarini wrote:
>
>> Dear list members,
>>
>> Within a loop, I need to create an xyplot with only a legend, not
>> even
>> with the default external box drawn by lattice.
>>
>> I already managed to remove the axis labels and tick marks, but I
>> couldn't find in the documentation of xyplot how to remove the
>> external box.
>
> I found it by searching rhelp at the Newcastle site:
> From: Jerome Asselin
> Date: Fri 25 Jul 2003 - 07:54:15 EST
>
>
> trellis.par.set("axis.line",list(col=NA,lty=1,lwd=1))
>
> You can restore the earlier behavior with:
>
> trellis.par.set("axis.line",list(col="black",lty=1,lwd=1))
And this is what Sarkar demonstraates in the help page for wireframe:
wirfrm> ## transparent axes
wirfrm>
wirfrm> par.set <-
wirfrm+ list(axis.line = list(col = "transparent"),
wirfrm+ clip = list(panel = "off"))
wirfrm> print(cloud(Sepal.Length ~ Petal.Length * Petal.Width,
wirfrm+ data = iris, cex = .8,
wirfrm+ groups = Species,
wirfrm+ main = "Stereo",
wirfrm+ screen = list(z = 20, x = -70, y = 3),
wirfrm+ par.settings = par.set,
wirfrm+ scales = list(col = "black")),
wirfrm+ split = c(1,1,2,1), more = TRUE)
> --
> David
>
>>
>> I would really appreciate any help with this
>>
>>
>> ------------- START -----------
>> library(lattice)
>>
>> x<-1:100
>> cuts <- unique( quantile( as.numeric(x),
>> probs=c(0, 0.25, 0.5, 0.75, 0.9, 0.95, 1),
>> na.rm=TRUE) )
>>
>> gof.levels <- cut(x, cuts)
>> nlevels <- length(levels(gof.levels))
>>
>> xyplot(1~1, groups=gof.levels, type="n", xlab="", ylab="",
>> scales=list(draw=FALSE),
>> key = list(x = .5, y = .5, corner = c(0.5, 0.5),
>> title="legend",
>> points = list(pch=16, col=c(2,4,3), cex=1.5),
>> text = list(levels(gof.levels))
>> )
>> )
>>
>> ------------- END -----------
>
>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list