[R] multiple lines and plot

David Barron mothsailor at googlemail.com
Wed Sep 20 11:35:00 CEST 2006


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



More information about the R-help mailing list