R: [R] help with histogram

About this list Date view Thread view Subject view Author view Attachment view

From: Guazzetti Stefano (Stefano.Guazzetti@ausl.re.it)
Date: Fri 07 May 2004 - 22:45:22 EST


Message-id: <F298786BF61DE64590054AF31EA1B4C8016D1FA5@PEPI.ausl.org>

Maybe you want something like:

x<-rnorm(1000)
hist(x, breaks=100,
 col=ifelse(abs((hist(x, breaks=100, main=""))$breaks) < 1.669,
 4,2))

see also the density argument in ?hist
Stefano

> -----Messaggio originale-----
> Da: Martin Olivier [mailto:martinol@ensam.inra.fr]
> Inviato: venerd́ 7 maggio 2004 14.40
> A: r-help
> Oggetto: [R] help with histogram
>
>
> Hi all,
>
> I need some help with the function histogram. Let x be a vector.
> The command hist(x,col="blue") gives an histogram for the vector x.
> I would like to add some colors in the graphics such that the
> histogram is
> red if abs(x)>1.669 and blue otherwise...and what is the
> solution if I
> want to
> change the filling instead of the color
>
> Thanks for your help,
> Olivier
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:08 EST