Skip to content
Back to formatted view

Raw Message

Message-ID: <20110408120656.GA5932@maker>
Date: 2011-04-08T12:06:56Z
From: Philipp Pagel
Subject: xyplot, groups and colors

Dear ExpeRts,

I am trying to plot a bunch of growth curves and would like to get
some more control over groups and line colors than I seem to have.

Example:

# make some data
dat <- Orange
dat$group <- ifelse(dat$Tree%in%c('1','4','5'), 'A', 'B')

# plot
xyplot(circumference~age, dat, groups=group)

# now use lines to make the growth curve more visible
xyplot(circumference~age, dat, groups=group, type='l')
# ugly, because of the 'return' lines

# to fix this set groups to Tree
xyplot(circumference~age, dat, groups=Tree, type='l')
# better, but now each Tree has its own color

Of course I can now use the col argument to manually assign the colors
by group but is there a more elegant way that I missed?

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f?r Genomorientierte Bioinformatik
Technische Universit?t M?nchen
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/