I would like to plot the density function of a Poisson distribution. I am not sure why I get a jaggy line (in blue). On the sample plot, the normal density curve (in red) looks smooth. It is because the reason the Poisson density function doesn't accept decimal values? How to eliminate the zigzag in the Poisson density plot? Thanks very much for any help.
library(ggplot2)
ggplot(data.frame(X = seq(5, 30)), aes(x = X)) +
stat_function(fun=dpois, geom="line", size=2, color="blue3", args = list(lambda = 15)) +
stat_function(fun=dnorm, geom="line", size=2, color="red4", args = list(mean=20, sd=2))
来源:https://stackoverflow.com/questions/28073783/ggplot-poisson-density-curve-why-zigzag-lines