Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like "overlay" ? Thank you, Mauricio
?lines On 20/09/06, Mauricio Cardeal <mcardeal at ufba.br> wrote:> Hi. Please, how can I put together 2 or more lines at the same > scatterplot ? Example: measures of protein intake (quantitative) of 4 > children over 30 days, by day. How to plot all children at same graphic: > Protein X Time ? Is there any command like "overlay" ? > > Thank you, > Mauricio > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- ================================David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP
Hi Have you searched the R-project web? There are plenty of "overlay" commands. Have you looked at plot help page? The first example shows you how to put line on existing scatterplot. So plot, lines and points are the basics for standard plot customisation. HTH Petr On 19 Sep 2006 at 22:50, Mauricio Cardeal wrote: Date sent: Tue, 19 Sep 2006 22:50:45 -0300 From: Mauricio Cardeal <mcardeal at ufba.br> To: r-help at stat.math.ethz.ch Subject: [R] multiple lines and plot> Hi. Please, how can I put together 2 or more lines at the same > scatterplot ? Example: measures of protein intake (quantitative) of 4 > children over 30 days, by day. How to plot all children at same > graphic: Protein X Time ? Is there any command like "overlay" ? > > Thank you, > Mauricio > > ______________________________________________ > R-help at stat.math.ethz.ch 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.Petr Pikal petr.pikal at precheza.cz
Mauricio Cardeal wrote:> Hi. Please, how can I put together 2 or more lines at the same > scatterplot ? Example: measures of protein intake (quantitative) of 4 > children over 30 days, by day. How to plot all children at same graphic: > Protein X Time ? Is there any command like "overlay" ?Make the plot for one child and add other with connands uch as lines() or segments(), don't know what is best in your case. Uwe Ligges> Thank you, > Mauricio > > ______________________________________________ > R-help at stat.math.ethz.ch 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.
Ok. I?ve already tried ?lines. An example: x <- c(1,2,3,4,5,6) y <- c(3,5,2,4,1,4) z <- c(2,3,4,3,2,1) plot(x,y) lines(x,y) lines(x,z) Here is the point: how to show the points under the second line (x,z) ? Thanks Mauricio David Barron escreveu:> ?lines > > On 20/09/06, Mauricio Cardeal <mcardeal em ufba.br> wrote: >> Hi. Please, how can I put together 2 or more lines at the same >> scatterplot ? Example: measures of protein intake (quantitative) of 4 >> children over 30 days, by day. How to plot all children at same graphic: >> Protein X Time ? Is there any command like "overlay" ? >> >> Thank you, >> Mauricio >> >> ______________________________________________ >> R-help em stat.math.ethz.ch 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. >> > >
You can specify the same type parameter in either lines() or points() that can be used in plot(). So, if you want to show points as well as lines, use the following: x <- c(1,2,3,4,5,6) y <- c(3,5,2,4,1,4) z <- c(2,3,4,3,2,1) plot(x,y,type="b") lines(x,z,col="red",type="b") On 20/09/06, Mauricio Cardeal <mcardeal at ufba.br> wrote:> Ok. I?ve already tried ?lines. An example: > > x <- c(1,2,3,4,5,6) > y <- c(3,5,2,4,1,4) > z <- c(2,3,4,3,2,1) > plot(x,y) > lines(x,y) > lines(x,z) > > Here is the point: how to show the points under the second line (x,z) ? > > Thanks > Mauricio > > > David Barron escreveu: > > ?lines > > > > On 20/09/06, Mauricio Cardeal <mcardeal at ufba.br> wrote: > >> Hi. Please, how can I put together 2 or more lines at the same > >> scatterplot ? Example: measures of protein intake (quantitative) of 4 > >> children over 30 days, by day. How to plot all children at same graphic: > >> Protein X Time ? Is there any command like "overlay" ? > >> > >> Thank you, > >> Mauricio > >> > >> ______________________________________________ > >> R-help at stat.math.ethz.ch 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-help at stat.math.ethz.ch 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. >-- ================================David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP