rrendas at cox.net wrote:> I'm having trouble with the order of the panels using xyplot. I had
used this bit of code before and received the desired plot (the code was not
identical, but very similar; perhaps more importantly I was working with an
older version of R) . Now the panels appear right to left instead of left to
right, as it says in the help files, which is what I would like. Does anyone
know if this has been changed? OR has anybody encountered this problem and a
way of fixing it?
>
> Below is the code I'm using (ctry_pfi and v291 are factors, with 16 and
2 levels, respectively)):
>
> superpose.line <- trellis.par.get("superpose.line")
> superpose.line$lwd <- 3
> superpose.line$lty <- c(1,2)
> trellis.par.set("superpose.line", superpose.line)
>
> trellis.strip.blank()
> trellis.par.set(list(background = list(col = "white")))
>
> xyplot(pfi~age|ctry_pfi,groups= v291,data=pfi,
> panel=panel.superpose, type=c("n", "smooth"),
> span=.75, as.table=F, col=c(4,2), lwd=2, lty=c(1,2),
> xlab = 'Age', ylab='Progressive Feminism Index (PFI)',
> xlim=c(10, 100), ylim=c(10,25),
> key = list(lines =
Rows(trellis.par.get("superpose.line"), c(14, 5)),
> lwd=3, lty=c(2,1), text = list(lab = c('Women', 'Men')),
> space="bottom", border=T, columns=2))
>
I haven't noticed if anything's been changed. However, you can always
explictly define the panel order by setting the levels of your grouping
variable (i.e. ctry_pfi in your case). See ?factor.
HTH,
--sundar