Just adding a note here that if you use `plot.function`

(which calls `curve`

itself) in place of the last `curve`

call in the following way, you'll get the expected output:

```
plot.function(x = function(t) dnorm(x = t, mean = mean(x = x), sd = sd(x = x)),
to = 100.0, # min(.Last.value$x)
from = 320.0, # max(.Last.value$x)
n = 101, # not necessary
add = TRUE,
col = "red")
```

I don't know the answer, and will try to dig into this over the weekend.

**Edit**

I think the trick is to use `xname`

to avoid confusion, as follows.

```
set.seed(seed = 1L)
x <- rnorm(n = 1e3L,
mean = 200,
sd = 30)
hist(x = x,
probability = TRUE,
ylim = c(0, 0.015))
curve(expr = dnorm(x = x, mean = 200, sd = 30),
col = "black",
lty = 1,
lwd = 2,
add = TRUE)
curve(expr = dnorm(x = x,
mean = 199.6506,
sd = 31.04748),
col = "green",
lty = 1,
lwd = 2,
add = TRUE)
# plot.function(x = function(t) dnorm(x = t,
# mean = mean(x = x),
# sd = sd(x = x)),
# from = min(.Last.value$x),
# to = max(.Last.value$x),
# col = "red",
# lwd = 2,
# add = TRUE)
curve(expr = dnorm(x = t,
mean = mean(x = x),
sd = sd(x = x)),
add = TRUE,
xname = "t",
col = "red",
lwd = 2)
```

^{Created on 2019-08-02 by the reprex package (v0.3.0)}

Does this help ?