Skip to content

plot

4 messages · IZHAK shabsogh, Marc Schwartz, Tom +1 more

#
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
#
On Sep 19, 2014, at 10:48 AM, IZHAK shabsogh <ishaqbaba at yahoo.com> wrote:

            
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
Tom
#
plot(x=range(x),y=range(c(y1,y2,y3.y4),type='n')
lines(x=x,y=y1,lty=1)
lines(x=x,y=y2,lty=2)
lines(x=x,y=y3,lty=3)
lines(x=x,y=y4,lty=4)

legend('bottomright',c('Y1','Y2','Y3','Y4','Y5'),lty=1:4)


or something like that.
On Fri, 2014-09-19 at 14:11 -0500, Marc Schwartz wrote:
#
Looks like homework to me.

cheers,

Rolf

P. S.  In any case, so some basic reading of introductory R material, 
available from the R web page.

R.
On 20/09/14 03:48, IZHAK shabsogh wrote: