Skip to content
Back to formatted view

Raw Message

Message-ID: <1197476937.9595.123.camel@prometheus.geog.ucl.ac.uk>
Date: 2007-12-12T16:28:57Z
From: Gavin Simpson
Subject: Overlay PDF on histogram
In-Reply-To: <CDCD66E2-6E16-4F28-B198-92B36560B53D@gmail.com>

On Wed, 2007-12-12 at 09:16 -0700, James wrote:
> Hi,
> 
> I thought that I had read somewhere that there was a really simple  
> way to overlay the probability density function of a normal  
> distribution over a histogram, after the histogram has already been  
> plotted.  Possibly a one word command.
> 
> I've found this email from the archives, but I don't think this is  
> what I'm looking for.  I thought there was something more simple than  
> the curve function.
> 
> http://tolstoy.newcastle.edu.au/R/help/05/04/3523.html
> 
> R> x <- rnorm(100)
> R> hist(x, freq = FALSE)
> R> curve(dnorm, col = 2, add = TRUE)
> 
> Is there a simple way to do this, or is my memory failing me?  Thank  
> you.
> 
> James

That seems simple enough to me. 1 line, the holy grail!

Is there a problem with using curve in your actual application?

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%