[R] lattice package: Changing colors in graphs

Bert Gunter gunter.berton at gene.com
Thu Feb 25 06:25:41 CET 2010


?trellis.par.get

?panel.histogram

... and in general panel.whatever for whatever() lattice functions.
Typically graphical parameters are passed though the ... arguments. You need
to **carefully** read the docs. 


Bert Gunter
Genentech Nonclinical Statistics

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Ravi Kulkarni
Sent: Wednesday, February 24, 2010 7:57 PM
To: r-help at r-project.org
Subject: [R] lattice package: Changing colors in graphs

Giving different colors to plots of different levels of a factor can
be pleasing. For a boxplot, for example, the following produces a nice
plot:

boxplot(len~supp*dose, data=ToothGrowth, col=c("orange","gray"))

 If I try to specify (using the lattice package)

histogram(~len|supp*factor(dose), data=ToothGrowth, col=c("orange","gray"))

 the effect is unexpected! (and certainly not desirable)

How does one do the same with histograms using the lattice package?
Also, how do I get more control over the colors of the "title bars"
for each pane in the lattice of graphs using the lattice package?

Ravi

______________________________________________
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