Say, I am using facet_grid() in ggplot2 to obtain 2 histograms. Now I want to superimpose these histograms with Poisson curves (having different means for the 2 histogram plots/grids) and a second curve of another distribution (for which I want to manually provide the probability function of values). How can this be done?
constructing an example:
library(ggplot2)
value<-c(rpois(500,1.5))
group<-rep(c("A","B"),250)
data<-data.frame(value,group)
g1<-ggplot(data,aes(value))
g1+geom_histogram(aes(y=..count..),binwidth=1,position="identity")+facet_grid(.~group)
what next?
Alternatively, can it be done using the lattice package?