Re: [R] superimpose density line over hist

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Wed 14 Dec 2005 - 02:59:53 EST


On 13-Dec-05 Albert Vilella wrote:
> Hi all,
>
> I'm trying to superimpose a rchisq density line over a histogram with
> something like:
>
> hist(alnlength)
> lines(density(rchisq(length(alnlength), 4)),col="red")
>
> But the rchisq line won't appear anywhere,
>
> Anyone knows what I am missing here?

Following up my earlier reply, and more in line with your precise question above:

  alnlength<-rchisq(1000,4)
  hist(alnlength,breaks=0.25*(0:100))
  j<-density(rchisq(1000,4))
  lines(j$x,1000*0.25*j$y)

Best wishes,
Ted.



E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 13-Dec-05                                       Time: 15:59:50
------------------------------ XFMail ------------------------------

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 14 03:33:39 2005

This archive was generated by hypermail 2.1.8 : Wed 14 Dec 2005 - 04:31:30 EST