[R] Histogram and Density on the the same graph

Jakson A. Aquino jaksonaquino at gmail.com
Tue Dec 1 00:22:27 CET 2009


On Mon, Nov 30, 2009 at 12:01:12PM +0100, Trafim wrote:
> Dear all,
> 
> I cannot find a function which would allow drawing hist and density on the
> same graph.
> 
> x <- seq(1,40,1)
> y <- 2*x+1+5*rnorm(length(x))
> 
> hist(y,freq = FALSE)
> plot(density(y))

The package descr has the function histkdnc() which plots a
histogram with kernel density and normal curve. I mantain the
package but this function was written by Dirk Enzmann.

-- 
Jakson




More information about the R-help mailing list