[R] plotting a distribution curves

Douglas Bates bates at stat.wisc.edu
Wed Sep 3 15:38:30 CEST 2003


"Petr Pikal" <petr.pikal at precheza.cz> writes:

> Hallo
> 
> On 1 Sep 2003 at 16:25, Rajarshi Guha wrote:
> 
> > Hi,
> >   is there a way to plot distribution curves (say normal or chi sq
> >   etc)
> > from within R?
> > 
> > For example I looked up the *chisq family of functions but I'm not
> > sure as to how I would use them to generate a plot of the chi sq
> > distribution (for arbitrary d.o.f).
> 
> Something like that
> 
> plot(seq(-3,3,.1),dnorm(seq(-3,3,.1)),type="l")
> plot(seq(0,20,.1),dchisq(seq(0,20,.1),5),type="l")

Perhaps it is easier to use 'curve'

curve(dnorm, from = -3, to = 3)
curve(dchisq(x,df=5), from = 0, to = 20)




More information about the R-help mailing list