>>>>> "allan" == allan clark <[EMAIL PROTECTED]>
>>>>>     on Tue, 03 Feb 2004 09:59:31 +0200 writes:

    allan> Hi all Another simple question.

    allan> I would like to plot three graphs one the same plot
    allan> with different colours. Say red, blue and black. Here
    allan> are the functions.

    allan> r1<-1+5*cos(2*pi*seq(1:100)/20)+rnorm(100)
    allan> r2<-1+7*sin(2*pi*seq(1:100)/20)+rnorm(100)
    allan> r3<-1+7*sin(2*pi*seq(1:100)/20)+5*cos(2*pi*seq(1:100)/20)+rnorm(100)

Use matplot()  and save intermediate things such as in


n <- 100
x <- 2*pi* seq(1:n)/20
mx <- cbind(r1 = 1+5*cos(x) + rnorm(n),
            r2 = 1+7*sin(x) + rnorm(n),
            r3 = 1+7*sin(x)+5*cos(x)+rnorm(n))

matplot(x, mx, type = 'b')
# or if you really want other colours (and no points, e.g.)
matplot(x, mx, type = 'l', col = c("red", "blue", "black"))

Regards,
Martin Maechler <[EMAIL PROTECTED]>     http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16    Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich     SWITZERLAND
phone: x-41-1-632-3408          fax: ...-1228                   <><

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to