[R] help on ploting various lines

Neuro LeSuperHéros neuro3000 at hotmail.com
Wed Jun 21 19:03:07 CEST 2006


Hi.  set a ylim equal to the max of your data:

#create test data
x1 <- x2 <-x3 <-(1:10)
y1 <-runif(10)/2 #to get a low maximum y1
y2 <-runif(10)
y3 <-runif(10)

#plot as you did
plot(x=x1,y=y1,type="l") #y-axis is not big enough
lines(x=x2,y=y2)
lines(x=x3,y=y3)

#plot with minimum/maximum y limit
plot(x=x1,y=y1,type="l",ylim=c(min(y1,y2,y2),max(y1,y2,y2))) #fixed
lines(x=x2,y=y2)
lines(x=x3,y=y3)

Neuro



>From: Baoqiang Cao <caobg at email.uc.edu>
>Reply-To: caobg at email.uc.edu
>To: R-help at stat.math.ethz.ch
>Subject: [R] help on ploting various lines
>Date: Wed, 21 Jun 2006 12:22:16 -0400 (EDT)
>
>Dear All,
>
>I tried to plot a variety of lines(curves) on same figure. What I did is,
>plot(x=x1,y=y1)
>lines(x=x2,y=y2)
>lines(x=x3,y=y3)
>...
>
>In my data, the maximum of y1 is much smaller than those maximums of other 
>y vectors. So, in the figure I got, there are some curves which are not 
>complete, I mean, they were cut off at the maximum of y1 at the y axis. 
>Could anybody point out some right commands I need use? Thanks!
>
>Best,
>  Cao
>
>______________________________________________
>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



More information about the R-help mailing list