[R] Multi-line plots - max Y?

Mark Knecht markknecht at gmail.com
Fri Jul 3 22:43:23 CEST 2009


On Fri, Jul 3, 2009 at 1:38 PM, Dylan
Beaudette<dylan.beaudette at gmail.com> wrote:
> Hi,
>
> how about something like this:
>
> a <- 1:10
> b <- cumsum(a)
> c <- cumsum(b)
> d <- cumsum(c)
>
> X<- data.frame(a,b,c,d)
>
>
> plot(b ~ a, data=X, type="l", col="blue", ylim=c(0,max(X)))
> lines(c ~ a, data=X, col="green")
> lines(d ~ a, data=X, col="red")
> legend('topleft', legend=c('a', 'b', 'c'), col=c('blue', 'green', 'red'), lty=1)
>

Darn you make it look easy! Thanks!

- Mark




More information about the R-help mailing list