[R] ggplot2 Histogram with density curve

wwreith reith_william at bah.com
Tue Jun 7 17:08:01 CEST 2011


I am learning ggplot2 commands and I have figured out how to create
histograms and density curves but I am not sure how to add a density curve
on top of a histogram. 

Here are the two graphs that I created. 

## Histogram
t<-rnorm(500)
w<-qplot(t, main="Normal Random Sample", fill=I("blue"), colour=I("black"),
geom="histogram")
w

##Density Curve
t<-rnorm(500)
r<-qplot(t, main="Normal Random Sample", colour=I("black"), geom="density",
adjust=4)
r

--
View this message in context: http://r.789695.n4.nabble.com/ggplot2-Histogram-with-density-curve-tp3579894p3579894.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list