Re: [R] Several Lattice plots in one Plot

2010-09-30 Thread Ken Knoblauch
Marcus Drescher  tum.de> writes:

> I've been trying for hours, but I do not find a Solution. I want to plot 12 
variables over time in 
separate
> diagrams in one plot/window using lattice. Two columns, six rows. 
I used print with the split 
command, but
> the graphics are getting really small. Can someone please help me.
> 
> Following data example:
> dta = data.frame(
> day=c(1,2,3,4,5,6,7),
> var11=c(1,2,2,4,5,3,2),
> var12=c(1,2,2,4,5,3,2),
> var13=c(1,2,2,4,5,3,2),
> var14=c(1,2,2,4,5,3,2),
> var15=c(1,2,2,4,5,3,2),
> var16=c(1,2,2,4,5,3,2),
> var17=c(1,2,2,4,5,3,2),
> var18=c(1,2,2,4,5,3,2),
> var19=c(1,2,2,4,5,3,2),
> var10=c(1,2,2,4,5,3,2),
> var11=c(1,2,2,4,5,3,2),
> var12=c(1,2,2,4,5,3,2))
> 
> Any idea how I can plot varXX over day like xyplot(var11 ~ day, 
data=dta, type='b', 
scales=list(cex=0.5),
> xlab=NULL, ylab=list(cex=0.5)) and get readable graphs?
> 
> Thanks in advance.
> Marcus

There are surely several ways to do this but how about

DTA <- cbind(day = dta$day, stack(dta[, -1]))
xyplot(values ~ day | ind, DTA, type = "b", layout = c(2, 6)) 

for which you can add additional annotations as desired.

By the way, do you realize that you have repeated column
names in your data frame?

HTH,

Ken

-- 
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html

__
R-help@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.


[R] Several Lattice plots in one Plot

2010-09-30 Thread Marcus Drescher
Hi all,

I've been trying for hours, but I do not find a Solution. I want to plot 12 
variables over time in separate diagrams in one plot/window using lattice. Two 
columns, six rows. I used print with the split command, but the graphics are 
getting really small. Can someone please help me.

Following data example:
dta = data.frame(
day=c(1,2,3,4,5,6,7),
var11=c(1,2,2,4,5,3,2),
var12=c(1,2,2,4,5,3,2),
var13=c(1,2,2,4,5,3,2),
var14=c(1,2,2,4,5,3,2),
var15=c(1,2,2,4,5,3,2),
var16=c(1,2,2,4,5,3,2),
var17=c(1,2,2,4,5,3,2),
var18=c(1,2,2,4,5,3,2),
var19=c(1,2,2,4,5,3,2),
var10=c(1,2,2,4,5,3,2),
var11=c(1,2,2,4,5,3,2),
var12=c(1,2,2,4,5,3,2))

Any idea how I can plot varXX over day like xyplot(var11 ~ day, data=dta, 
type='b', scales=list(cex=0.5), xlab=NULL, ylab=list(cex=0.5)) and get readable 
graphs?

Thanks in advance.
Marcus

__
R-help@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.