Hi.. thanks for the tips.. that variation works. How can I control "pch",
"lty" and "col" for each member (gp1) in the group (paste(gp2, gp3))?
Regards,Santosh

On Tue, Jan 5, 2010 at 2:15 AM, Felix Andrews <felix@nfrac.org> wrote:

> You should reshape the data into a long format, and an easy way to do
> that is to use the 'reshape' package:
>
> library(reshape)
> mdat <- melt(dat, measure.vars = c("y1", "y2", "y3"))
>
> I'm still not sure what you want in the plot. Confusingly, your last
> example dropped the "ID" you referred to earlier, and appears to use
> "grp1" in the same role.
>
> Maybe something like this:
>
> xyplot(value ~ x | paste(gp2, gp3), mdat,
>       groups = paste(variable, gp1), type = "l",
>       auto.key = list(lines = TRUE, columns = 3),
>       par.settings = simpleTheme(col = 1:8, lty = rep(1:3, each = 8)))
>
>
>
> 2010/1/5 Santosh <santosh2005@gmail.com>:
> > Thanks for your email.. Yes, I am looking for lattice version of
> matplot...
> > Attached are some codes for simplicity for rapid testing..Any suggestions
> > would be highly appreciated...
> >
> > library(lattice)
> > dat <- data.frame(x = rep(1:10,2),
> >                  y1 = rnorm(20),
> >                  y2=rnorm(20,sd=1.3),
> >                  y3=rnorm(20,sd=0.3),
> >                  gp1 = rep(letters[1:8],each=10),
> >                  gp2=rep(LETTERS[1:4],each=20),
> >                  gp3=rep(c("P","Q"),each=40))
> >
> > pset <- simpleTheme(lty = c(0,1,2), col=c("blue","red","green"))
> > xyplot(y1+y2+y3~x|factor(gp3)+factor(gp2),
> >        data=dat,
> >        groups=gp1,
> >        allow.multiple=T,
> >        panel=panel.superpose,
> >        distribute.type=T,
> >        type=c("b","l","l"),
> >        par.settings=pset,
> >        strip=strip.custom(strip.names=F,strip.levels=T))
> >
> > Thanks..
> > Santosh
> >
> >
> > On Mon, Jan 4, 2010 at 11:16 PM, Dennis Murphy <djmuser@gmail.com>
> wrote:
> >
> >> Hi:
> >>
> >> I think Santosh wants a Lattice version of matplot. I didn't find
> anything
> >> with help.search(), though...
> >>
> >> Dennis
> >>
> >>
> >> On Mon, Jan 4, 2010 at 8:14 PM, Santosh <santosh2005@gmail.com> wrote:
> >>
> >>> Hi,
> >>> Thanks for your email..
> >>>
> >>> Each panel (in a multiple panel) is identified by "DS1, DS2 & DS3" in
> the
> >>> dataset sent earlier. I would like an overlay of Y1, Y2 & Y3 (each by
> >>> different lines) for each ID in the group. Each ID in the group is
> >>> represented by a color.
> >>>
> >>> Regards & Thanks,
> >>> Santosh
> >>>
> >>> On Mon, Jan 4, 2010 at 5:07 PM, Peter Ehlers <ehlers@ucalgary.ca>
> wrote:
> >>>
> >>> > Can you clarify how many curves you want in each panel?
> >>> > You have 3 Ys and your original email indicated at least
> >>> > 7 ID values. Do you really want 21 curves in each panel?
> >>> > Or do you want separate panels for the Ys?
> >>> >
> >>> > Re your code: note that, regarding a formula of the
> >>> > type y1 + y2 ~ x, ?xyplot says:
> >>> >
> >>> > "This feature cannot be used in conjunction with
> >>> > the groups argument."
> >>> >
> >>> >  -Peter Ehlers
> >>> >
> >>> > Santosh wrote:
> >>> >
> >>> >> Hi Jim and others,
> >>> >>
> >>> >> I tried suggestions and somehow the graphs do not seem to be aligned
> on
> >>> >> X-axis (i.e. they appear to be shifted on x-axis).. I guess
> >>> panel.xyplot
> >>> >> or
> >>> >> panel.superpose is needed? I am not sure what the "group" variable
> be
> >>> >> panel.xyplot, whether it is the "ID" or the "newFactor". I tried
> >>> >> panel.xyplot(x,y,) with "group=ID" and "group=newFactor" and it did
> not
> >>> >> work.
> >>> >>
> >>> >> Your suggestions would be highly appreciated!!
> >>> >>
> >>> >> Regards,
> >>> >> Santosh
> >>> >>
> >>> >> On Thu, Dec 31, 2009 at 6:59 PM, jim holtman <jholtman@gmail.com>
> >>> wrote:
> >>> >>
> >>> >>  I am not too sure if this is what you are after, but I just created
> a
> >>> new
> >>> >>> factor for the panel:
> >>> >>>
> >>> >>> # create a new factor
> >>> >>> d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3))
> >>> >>> xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID)
> >>> >>>
> >>> >>>
> >>> >>> On Thu, Dec 31, 2009 at 6:25 AM, Santosh <santosh2005@gmail.com>
> >>> wrote:
> >>> >>>
> >>> >>>  Dear R experts,
> >>> >>>> Wish you all a HAPPY NEW YEAR!
> >>> >>>>
> >>> >>>> How do I go about plotting (using lattice) overlays of an ID
> >>> (group=ID)
> >>> >>>> observed, fitted data in each panel of a multiple panel plot (each
> >>> panel
> >>> >>>> identified by DS1 + DS2 + DS3)? "x" variable is X1 in the
> >>> accompanying
> >>> >>>> section of a dataset. each individual is identified by color and
> Y's
> >>> are
> >>> >>>> identified by "pch" or "lty".
> >>> >>>>
> >>> >>>> I guess the code goes something like the one below, but could not
> get
> >>> >>>> the
> >>> >>>> proper use of panel functions....
> >>> >>>>
> >>> >>>> xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...)...
> >>> >>>>       [[alternative HTML version deleted]]
> >>> >>>>
> >>> >>>> ______________________________________________
> >>> >>>>
> >>> >>>> 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<
> >>> >>>> http://www.r-project.org/posting-guide.html>
> >>> >>>>
> >>> >>>> and provide commented, minimal, self-contained, reproducible code.
> >>> >>>>
> >>> >>>>
> >>> >>>
> >>> >>> --
> >>> >>> Jim Holtman
> >>> >>> Cincinnati, OH
> >>> >>> +1 513 646 9390
> >>> >>>
> >>> >>> What is the problem that you are trying to solve?
> >>> >>>
> >>> >>>
> >>> >>        [[alternative HTML version deleted]]
> >>> >>
> >>> >> ______________________________________________
> >>> >> 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.
> >>> >>
> >>> >>
> >>> >>
> >>> > --
> >>> > Peter Ehlers
> >>> > University of Calgary
> >>> > 403.202.3921
> >>> >
> >>>
> >>>        [[alternative HTML version deleted]]
> >>>
> >>> ______________________________________________
> >>> 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.
> >>>
> >>
> >>
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
>
>
>
> --
> Felix Andrews / 安福立
> Postdoctoral Fellow
> Integrated Catchment Assessment and Management (iCAM) Centre
> Fenner School of Environment and Society [Bldg 48a]
> The Australian National University
> Canberra ACT 0200 Australia
> M: +61 410 400 963
> T: + 61 2 6125 4670
> E: felix.andrews@anu.edu.au
> CRICOS Provider No. 00120C
> --
> http://www.neurofractal.org/felix/
>

	[[alternative HTML version deleted]]

