[R] R: plotting multiple functions

Timur Elzhov Timur.Elzhov at jinr.ru
Tue Feb 3 10:13:47 CET 2004


On Tue, Feb 03, 2004 at 09:59:31AM +0200, allan clark wrote:

> Another simple question.
> 
> I would like to plot three graphs one the same plot with different
> colours. Say red, blue and black. Here are the functions.
> 
> r1<-1+5*cos(2*pi*seq(1:100)/20)+rnorm(100)
> r2<-1+7*sin(2*pi*seq(1:100)/20)+rnorm(100)
> r3<-1+7*sin(2*pi*seq(1:100)/20)+5*cos(2*pi*seq(1:100)/20)+rnorm(100)

plot(r1, type = "n")
points(r1, col = "red", pch = 19)  ## see also ?lines
points(r2, col = "blue", pch = 19)
points(r3, col = "black", pch = 19)




More information about the R-help mailing list