Curve geom_line() with ggplot

I used ggplot() and geom-line() as follows

ggplot(tabla3) + geom_line(aes(tabla3$MC, tabla3$Normal), lwd = 1)

Result: enter image description here

But I want it to look like this:

enter image description here

Upvotes: 2

Views: 958

Answers (1)

Jope
Jope

Reputation: 176

If you know the mean and standard deviation of your data, why not just plot a normal distribution?

x <- seq(50, 90, length=101)
hx <- dnorm(x, mean(x), sd(x))

plot(x, hx, type = 'l')

ggplot version

ggplot(data = tibble(x), aes(x)) +
  stat_function(fun = dnorm, n = 101, args = list(mean = mean(x), sd = sd(x))) + ylab("") +
  scale_y_continuous(breaks = NULL)

Upvotes: 1

Related Questions