[R] Adding axis lines to splom plots
Deepayan Sarkar
deepayan.sarkar at gmail.com
Tue Oct 16 20:59:03 CEST 2007
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
More information about the R-help
mailing list