[R] make three plot to one plot

Jan Sabee jan.sabee at gmail.com
Fri Oct 21 23:54:06 CEST 2005


Thanks to Marc and Gabor.
Have a nice weekend.
Best,
Jan Sabee

On 10/21/05, Jan Sabee <jan.sabee at gmail.com> wrote:
> Dear all,
> I want to make three plot below to only one plot together with legend,
> how can I do that?
> I have tried with matplot function but I did not succeed.
> Thanks for your help.
> Sincerelly,
> Jan Sabee
>
> test.five.x <- c(0.02,0.05,0.07,0.09,0.10,0.12,0.13,0.14,0.16,0.17,0.20,0.21,0.34,0.40)
> test.five.y <- c(18,12,17,12,3,15,1,5,1,1,3,10,15,10)
> plot(test.five.x, test.five.y, type="l",lty=1, lwd=3, col='red')
> legend(par('usr')[2], par('usr')[4], xjust=1,
>       c('five'),
>       lwd=3,
>       lty=1,
>       col=c('red'))
> test.six.x <- c(0.03,0.05,0.07,0.08,0.09,0.10,0.12,0.13,0.14,0.15,0.17,0.18,0.21,0.22,0.24,0.33,0.39,0.43)
> test.six.y <- c(8,32,14,21,3,8,11,14,11,21,16,14,10,21,1,2,13,19)
> plot(test.six.x, test.six.y, type="l",lty=2, lwd=3, col='green')
> legend(par('usr')[2], par('usr')[4], xjust=1,
>       c('six'),
>       lwd=3,
>       lty=2,
>       col=c('green'))
> test.seven.x <-
> c(0.04,0.05,0.08,0.09,0.10,0.12,0.13,0.14,0.16,0.17,0.19,0.21,0.22,0.24,0.29,0.32,0.38,0.40,0.46,0.50)
> test.seven.y <-
> c(18,135,240,42,63,128,215,267,127,36,21,23,223,12,66,96,12,26,64,159)
> plot(test.seven.x, test.seven.y, type="l",lty=3, lwd=2, col='blue')
> legend(par('usr')[2], par('usr')[4], xjust=1,
>       c('seven'),
>       lwd=3,
>       lty=3,
>       col=c('blue'))
>




More information about the R-help mailing list