Re: [R] plot numerous functions in one figure with different values of x per function

2011-02-21 Thread Dennis Murphy
Hi: Here's one way: f <- function(x) sin(x) + pi/4 g <- function(x) { sin(x) * (x >= 0 & x <= pi) + sin(x) * (x >= -2 * pi & x <= -pi) - (pi/4) * (x > -pi & x < 0) - pi/4 * (x > pi & x < 2 * pi) } x <- seq(-2 * pi, 2 * pi, length = 200) plot(x, f(x), type = 'l', col = 'blue', yli

[R] plot numerous functions in one figure with different values of x per function

2011-02-21 Thread Gloria_M
To the more experienced R users, I am not a professional programmer so please excuse me if my questions seem naive. I have only begun using R to solve some problems and I'm already regretting it 1. I am trying to plot different functions in the same figure. The first function f(x)= sin(x)+(pi/