Re: [R] help with histogram

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

From: Martin Maechler (maechler@stat.math.ethz.ch)
Date: Sat 08 May 2004 - 01:20:28 EST


Message-id: <16539.43324.807147.749836@gargle.gargle.HOWL>


>>>>> "Guazzetti" == Guazzetti Stefano <Stefano.Guazzetti@ausl.re.it>
>>>>> on Fri, 7 May 2004 14:45:22 +0200 writes:

    Guazzetti> Maybe you want something like:

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

    Guazzetti> see also the density argument in ?hist

very good!

Even slightly better {not calling hist() twice} is

 x <- rnorm(1000)
 hx <- hist(x, breaks=100,plot=FALSE)
 plot(hx, col=ifelse(abs(hx$breaks) < 1.669, 4, 2))

Regards, Martin

______________________________________________
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