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

Marius Hofert m_hofert at web.de
Sat Nov 27 13:46:40 CET 2010


Thanks very much, exactly what I was looking for :-)))

Cheers,

Marius

On 2010-11-27, at 13:16 , Peter Ehlers wrote:

> On 2010-11-27 03:31, Marius Hofert wrote:
>> 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 :-(
>> 
> 
> xyplot. <- function(u) {
> 	xyplot(u[,2] ~ u[,1],
>        par.settings = standard.theme(color=FALSE))
> }
> 
> see ?xyplot.ts
> 
> Peter Ehlers
> 
>> 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)
>>> 
>>> 
>>> 
>> 
>> ______________________________________________
>> 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.
> 



More information about the R-help mailing list