[R] Adding axis lines to splom plots

Sarah Barry sarah at stats.gla.ac.uk
Wed Oct 17 11:17:29 CEST 2007


Thank you, Deepayan, that works perfectly!

Regards,
Sarah

Deepayan Sarkar wrote:
> On 10/16/07, Sarah Barry <sarah at stats.gla.ac.uk> wrote:
> 
>>Hi,
>>
>>I am trying to produce a 30x30 lattice grid.  The 30 variables naturally
>>fall into three groups of ten and I would like to add thicker axis lines
>>around these to highlight this.  However, I can only do this separately,
>>so far, and I don't know how to superimpose the grid with the thicker
>>lines (separating the 10x10 groups) onto the overall grid of all 30x30
>>plots.  I enclose a reproducible example:
>>
>>#####
>>require(lattice)
>>temp.df <- sapply(1:30, function(i) rnorm(20, 0,1))
>>
>>splom(~temp.df, aspect="fill", varnames=paste("coord", 1:30, sep=""),
>>xlab="", pscales=0, varname.cex=0.6, panel=function(x, y, ...){
>>   panel.xyplot(x,y, cex=0.2, xlab="", ylab="")
>>})
>>
>>splom(~matrix(c(1,2,3), nc=3), aspect="fill", varnames=NULL, xlab="",
>>pscales=0, axis.line.lwd=4, varname.cex=0.6, panel=function(x, y, ...){
>>   panel.xyplot(x,y, cex=0.2, xlab="", ylab="", type="n")
>>})
>>#####
> 
> 
> Thanks for the example. Try
> 
> splom(~temp.df, aspect="fill", varnames=paste("coord", 1:30, sep=""),
>       xlab="", pscales=0, varname.cex=0.6, cex=0.2,
>       ## panel = panel.xyplot, # unnecessary
>       superpanel = function(...) {
>           panel.pairs(...)
>           panel.grid(h = 2, v = 2, col = "black", lwd = 4)
>       })
> 
> 'superpanel' is documented in ?splom.
> 
> (BTW, panel.xyplot doesn't know anything about xlab, ylab, etc., and
> you can specify cex as part of the top level call)
> 
> -Deepayan

-- 
Sarah Barry, MSc
Department of Statistics
University of Glasgow
Tel: +44 (0)141 330 2474
Fax: +44 (0)141 330 4814
www.stats.gla.ac.uk/~sarah



More information about the R-help mailing list