[R] lattice: strange behavior (?) when using trellis.device(color=FALSE)
Marius Hofert
m_hofert at web.de
Sun Nov 28 08:03:32 CET 2010
Dear Peter,
thanks a lot, modifyList() did it perfectly!
Cheers,
Marius
On 2010-11-28, at 01:26 , Peter Ehlers wrote:
> On 2010-11-27 15:03, Marius Hofert wrote:
>> Dear Peter,
>>
>> do you know anything similar for a cloud() plot?
>> This does not work:
>>
>> library(lattice)
>> x<- matrix(runif(900),ncol=3)
>> cloud(x[,3]~x[,1]*x[,2],scales = list(col = 1, arrows=FALSE),
>> par.settings = list(standard.theme(color=FALSE),
>> axis.line=list(col="transparent"),
>> clip=list(panel="off")))
>
> I think this should do it:
>
> cloud(x[,3] ~ x[,1] * x[,2],
> scales = list(col = 1, arrows = FALSE),
> par.settings = modifyList(standard.theme(color = FALSE),
> list(axis.line = list(col = "transparent"),
> clip = list(panel = "off"))))
>
> (You have to modify the standard.theme parameters.)
>
> See ?modifyList and also:
> http://www.mail-archive.com/r-help@r-project.org/msg64699.html
>
> Peter Ehlers
>
>
>> 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