[R] color in xyplot
dwinsemius at comcast.net
Sat Jan 12 06:35:31 CET 2013
On Jan 11, 2013, at 8:38 PM, Elaine Kuo wrote:
> I want to draw a xyplot.
> Its dots will have three colors: red for meat, green for vegetable,
> blue for both.
> I used the code below but could not make the dot in the same group
> show the
> same color.
> Please kindly advise how to modify it.
I'm rather amazed you got anything. You are using base graphics
arguments with a lattice function. There is some overlap but there are
special functions like `trellis.par.set` and `trellis.par.get`.
Please read :
You need a lot of mental rearrangements to convert from base graphics
to lattice graphics.
> Thank you.
> library (lattice)
> diet.code <- c("Herbivore", "Omnivore", "Carnivore")
> Diet.colors <- c("forestgreen", "darkblue","red2")
> levels(dataN$Diet) <- diet.code
> # graph
> xyplot(GE_distance~Diet, data=dataN,
> xlab=list("Diet of Breeding Ground", cex = 1.4),
> ylab=list("Migration Distance",cex = 1.4),
> cex.lab=1.4, cex.axis=1.2,
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Alameda, CA, USA
More information about the R-help