Use the points
function. It has the same exact syntax as plot
.
So, for instance:
fun1 <- function(x) sin(cos(x)*exp(-x/2))
x <- seq(0, 2*pi, 0.01)
plot (x, fun1(x), type="l", col="blue", ylim=c(-0.8, 0.8))
points (x, -fun1(x), type="l", col="red")
Note that plot parameters like ylim
, xlim
, titles and such are only used from the first plot
call.
No comments:
Post a Comment