In [1]:
require(ggplot2)
require(reshape)
In [2]:
n <- 100
lambda <- 2
p <- 0.02
In [3]:
dat <- data.frame(x=0:n, pois=dpois(0:n, lambda), binom=dbinom(0:n, n, p))
df <- melt(dat, id.vars='x', variable_name='distr')
In [4]:
ggplot(df, aes(x, value, color=distr)) + geom_point()