[R] How to plot three graphs on one single plot?

Jim Lemon jim at bitwrit.com.au
Thu Feb 11 03:07:47 CET 2010


On 02/10/2010 09:17 PM, khazaei at ceremade.dauphine.fr wrote:
> Hello alla
>
> I have three kinds of information (x,y1),(x,y2),(x,y3) such that x and
> y1,y2,y3 are the vectors with the same dimention.
> Now I want to plot these three class af information on one plot.
> thank you for your help.
> khazaei
>
Hi khazaei,
Try this:

matplot(x,cbind(y1,y2,y3),type="l")
text(rep(x,3),c(y1,y2,y3),rep(c("y1","y2","y3"),each=16),
  col=rep(1:3,each=16))

Jim



More information about the R-help mailing list