Re: [R] xyplot, groups and colors

From: Philipp Pagel <>
Date: Mon, 11 Apr 2011 09:52:28 +0200

On Fri, Apr 08, 2011 at 08:14:21AM -0700, Dennis Murphy wrote:

Thanks to everyone who replied! Especialy this and the ggplot advice did what I wanted.

> xyplot(circumference~age, dat, groups=Tree, type='l',
> col.line = c('red', 'blue', 'blue', 'red', 'red'))

This is essentially what I had been doing after somehow creating the correct color vector.

> After a little more fiddling around, this also works, and seems a bit less
> kludgy:
> dat$group2 <- factor(dat$group, labels = c('red', 'blue'))
> xyplot(circumference~age, dat, groups=Tree, type='l',
> col.line = levels(dat$group2))

Perfect! Using the levels directly had not occured to me. Thanks!



Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 11 Apr 2011 - 07:55:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Apr 2011 - 08:40:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive