From: Gabor Grothendieck <ggrothendieck_at_gmail.com>

Date: Sat 22 Oct 2005 - 06:21:24 EST

R-help@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 Received on Sat Oct 22 06:26:29 2005

Date: Sat 22 Oct 2005 - 06:21:24 EST

# we can create a zoo object

library(zoo)

z <- merge(five = zoo(test.five.y, test.five.x), six = zoo(test.six.y, test.six.x), seven = zoo(test.seven.y, test.seven.x))

# and then plot it all in one go using na.approx to fill in generated NAs plot(na.approx(z), plot.type = "single", xlab = "x", ylab = "y", ,col = 1:3)

# Finally add the legend

legend("topright", xjust = 1, lty = 1,

legend = c("five", "six", "seven"), col = 1:3)

On 10/21/05, Jan Sabee <jan.sabee@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'))
**>
**> ______________________________________________
**> R-help@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
**>
*

R-help@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 Received on Sat Oct 22 06:26:29 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 19:16:35 EST
*