Utilizing panel.number and grid allowed me to do all my
desired manipulations - thanks Deepayan!
Roy
Original message
Date: Tue, 22 Nov 2005 13:47:20 -0600
From: Deepayan Sarkar [EMAIL PROTECTED]
Subject: Re: change axis format for different panels in
xyplot in lattice
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
On 11/22/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Dear R users,
My apologies for a simple question for which I suspect there
is a simple answer that I have yet to find. I'd like to plot
panels in lattice with different graphical parameters for the
axes. For example, the code
x-rnorm(100)
y-rnorm(100)
z-c(rep(1,50), rep(2,50))
library(lattice)
xyplot(y~x|z)
plots two panels with the default black axes. Running the
following code
trellis.par.set(list(axis.line = list(col = transparent)))
xyplot(y~x|z)
plots the same data without the axes. Is it possible (in one
plot) to plot the first panel with black axes and the second
panel with tranparent axes?
Not systematically, but consider this approach:
library(grid)
trellis.par.set(list(axis.line = list(col = transparent)))
xyplot(y~x|z,
panel = function(..., panel.number) {
if (panel.number == 1) grid.rect(gp = gpar(col =
'black'))
panel.xyplot(...)
} )
This is probably not exactly what you want, since the tick
marks are
transparent in both panels, but you get the idea. You can
gain finer
control of the axis annotation using panel.axis inside your panel
function (but you will need to disable clipping, controlled by
trellis.par.get(clip)). Alternatively, check out
?trellis.focus.
Deepayan
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html