[R] plot

Marc Schwartz marc_schwartz at me.com
Fri Sep 19 21:11:50 CEST 2014


On Sep 19, 2014, at 10:48 AM, IZHAK shabsogh <ishaqbaba at yahoo.com> wrote:

> Hi,
> kindly give me some guide on how to plot the following data in a single line graph that is ( y1,y2,y3,y4 against x) including title and key
> 
> y1<-c(0.84,1.03,0.96)
> y2<-c(1.30,1.46,1.48)
> y3<-c(1.32,1.47,1.5)
> y4<-c(0.07,0.07,0.07)
> x<-c(500,1000,2000)
> 
> Thanks
> Ishaq


See ?matplot and ?legend

matplot(x, cbind(y1, y2, y3, y4), type = "l", 
        main = "Plot Title", ylab = "Y Vals", 
        xlab = "X Vals")

legend("right", lty = 1:4, col = 1:4, 
       legend = c("y1", "y2", "y3", "y4"))


Regards,

Marc Schwartz



More information about the R-help mailing list