[R] lattice: strange behavior (?) when using trellis.device(color=FALSE)

Marius Hofert m_hofert at web.de
Sat Nov 27 12:31:08 CET 2010


Hi,

I get a warning () using 

xyplot. <- function(u) { 
	BW.theme <-
	    list(strip.background = list(col = "gray90"),
	         strip.shingle = list(col=c("gray75")),  
	         layout.heights = list(strip = c(1,1)),  
	         axis.text = list(cex = 0.8),            
	         superpose.symbol=list(col=1, pch=20)
	         )
	xyplot(u[,2]~u[,1],par.settings=BW.theme)
}
U <- matrix(runif(20),ncol=2)
b <- xyplot.(U)
b

and it does not change the color. Further, would such an approach change all colors (including plot symbols, text, background, etc.)? 

But it's funny to see because I played around with par.settings as well. I tried...

library(lattice)
xyplot. <- function(u) { 
	xyplot(u[,2]~u[,1],par.settings=list(color=FALSE))
}
U <- matrix(runif(20),ncol=2)
b <- xyplot.(U)
b

... but it didn't work :-(

Cheers,

Marius



On 2010-11-27, at 12:00 , ottorino wrote:

> Il giorno sab, 27/11/2010 alle 00.35 +0100, Marius Hofert ha scritto:
>> The reason why I would like to use trellis.device() within a function
>> is that 
>> the plot contains a panel.function which contains many calls to
>> panel.xyplot() 
>> and I do not want to write "col = 1" (e.g.) all the time... 
> 
> Why not to use a theme like
> 
> BW.theme <-
>    list(strip.background = list(col = "gray90"),
>         strip.shingle = list(col=c("gray75")),  
>         layout.heights = list(strip = c(1,1)),  
>         axis.text = list(cex = 0.8),            
>         superpose.symbol=list(col=1, pch=20)
>         )
> xyplot(V1~V2, par.settings = BW.theme)
> 
> 
> 



More information about the R-help mailing list