[R] ploting several functions on the same plot
juliosergio at gmail.com
Thu Apr 4 04:20:47 CEST 2013
Duncan Murdoch <murdoch.duncan <at> gmail.com> writes:
> curve(L1, add=TRUE) should handle it.
Your solution worked great!
However, I'm puzzled for a problem in the same line: When I passed a
"function producer" to plot, again it works well; however it doesn't work in
the same way when I try to use this same argument in curve. See what I'm
# A particular normal distribution function:
dn8 <- function(z,m) dnorm(z,m,8) # norm dist with sd=8
# A function that produces functions:
# returns a function such that given a mean(i) depends only
# on z
fi <- function(i) function(z) dn8(z,i)
plot(fi(370),xlim=c(360,420)) # Works well!
curve(fi(380),add=T) # This doesn't work
# But in this way, it works!
ff <- fi(380)
I cannot understand this behaviour. Could anyone give me some feedback on
More information about the R-help