[R] hist(x, ...) with normal distribution curve

Romain Francois francoisromain at free.fr
Tue Sep 27 11:04:00 CEST 2005


Le 27.09.2005 10:32, Peter Wolf a écrit :

>Knut Krueger wrote:
>  
>
>>I am looking for a histogram or box plot with the adding  normal 
>>distribution  curve
>>I think that must be possible, but I am not able to find out how to do.
>>
>>Regards Knut
>> 
>>    
>>
>*There are a lot of answers to add a histogram.
>Here is a simple way to add a tiny boxplot to a plot / histogram
>
>x<-rexp(100)
>hist(x)
>boxplot(x,axes=F,add=T,horizontal=T,
>     at=par()$usr[3]+diff(par()$usr[3:4])*.017,
>     boxwex=0.02*diff(par()$usr[3:4]),pch=8)
>
>Peter Wolf
>
>  
>
The tufte axes, described there : 
http://www.cl.cam.ac.uk/users/sjm217/projects/graphics/
may be of interrest here.

What about making it a possibility for all plots ? For example using :
R> par(xaxt='tufte')
R> plot(rnorm(200), rnorm(200))
would produce a scatterplot with the tufte axes

Romain.

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~      Romain FRANCOIS - http://addictedtor.free.fr         ~~~~~~
~~~~        Etudiant  ISUP - CS3 - Industrie et Services           ~~~~
~~                http://www.isup.cicrp.jussieu.fr/                  ~~
~~~~           Stagiaire INRIA Futurs - Equipe SELECT              ~~~~
~~~~~~   http://www.inria.fr/recherche/equipes/select.fr.html    ~~~~~~
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~




More information about the R-help mailing list