[R] manipulating colors in lattice

1-27206531-0-90000491 domi at sun11.ukl.uni-freiburg.de
Sat Apr 20 19:04:02 CEST 2002


Dear Prof. Ripley

Using your advice:

>library(lattice)
>library(nlme)
>data(Orthodont)
>plot(Orthodont)

>lset(theme = c("bw"))
Error in trellis.par.set("background", list(col = bg)) : 
        Object "bg" not found

I also do not understand the description of the help file:

>Usage:
>
>    lset(theme = c("col.bg", "white.bg", "bw"), file)
>
>Arguments:
>
>    file: the name of a file that will be `source()'d.

which file should be sourced in my case?

Also one sentence in the help file seems strange to me:

>     `lset' implements a concept of `themes' in Lattice. Themes are
>     predefined values of `trellis.settings' that modify the overall
>     look. The only current theme significantly different from the
>     defaults is the `"white.bg"' theme, which hopefully

The sentence ends after hopefully and I expect something after hopefully

I feel that the concept of themes is exactly what I need. But I can't
activate it. I also searching for examples in the help. But I cant find
one.

After reading cross help files and with some try and error I found a dirty
solution for my problem.

library(nlme)
library(lattice)
trellis.device(device="windows", color=F) # sets the output to bw
data(Orthodont)
plot(Orthodont)

Now I got exactly what I want. But if I want to export the plot to jpeg:

trellis.device(device="jpeg", color=F)
if(interactive()) {
	jpeg("c:/temp/mist.jpg", quality = 100)
	plot(Orthodont)
	dev.off()
}

The Jpeg- file is white without a picture. Then I tried to export it via
the GUI. This works fine. 

Now my question. How can I make proper use of "theme"? I'm aware that my
problem is probably caused by not understanding the principles of making
figures with Trellis. But perhaps you, ore someone else can clarify my
confuse thoughts or point me to some examples.

Thank you for your help,

Dominik
--------------------------------------------------------------------------
Domink Grathwohl; Bussstr. 34; D-79102 Freiburg



On Wed, 17 Apr 2002 ripley at stats.ox.ac.uk wrote:

> ?lset
> ?trellis.settings.
> 
> Reminder: Lattice is not Trellis and it is built on grid not S graphics,
> so you can't mix in ideas from S graphics.
> 
> If you want a black-and-white plot, use lset to set the bw theme.
> 
> 
> On Wed, 17 Apr 2002, 1-27206531-0-90000491 wrote:
> 
> > Dear R-users,
> >
> > I use:
> >
> > $platform
> > [1] "i386-pc-mingw32"
> > $arch
> > [1] "x86"
> > $os
> > [1] "Win32"
> > $system
> > [1] "x86, Win32"
> > $status
> > [1] ""
> > $major
> > [1] "1"
> > $minor
> > [1] "4.1"
> > $year
> > [1] "2002"
> > $month
> > [1] "01"
> > $day
> > [1] "30"
> > $language
> > [1] "R"
> >
> > I try  to repeat the analysis of Jose Pinheiro and Douglas Bates described
> > in their book: Mixed-Effects Models in S and S-PLUS.
> >
> > library(lattice)
> > library(nlme)
> > data(Orthodont)
> > plot(Orthodont)
> > fm1OrthF.lis <- lmList(distance ~ age, data=Orthodont)
> > plot(intervals(fm1OrthF.lis))
> > fm1OrthF <- lme(distance ~ age, data=Orthodont, random= ~ 1| Subject)
> > plot(augPred(fm1OrthF), aspect="xy", grid=TRUE)
> >
> > My question: How can I manipulate the colours of the different plots, say
> > changing symbols and lines from light-blue to black?
> > e.g. plot(Orthodont, col="black") changes only symbols to black and I have
> > no idea how to change the lines to black.
> >
> > Thanks in advance,
> >
> > Dominik
> >
> > ----------------------------------------------------------------------------
> > Dominik Grathwohl; Bussstr. 34; D-79102 Freiburg
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list