[Rd] histogram of frequencies (PR#861)
Mon, 5 Mar 2001 15:01:55 +0100 (MET)
Full_Name: Dr. Bernd Winkler
Submission from: (NULL) (184.108.40.206)
having updated to version 1.2.2 last week I experienced some strange behaviour
the hist function.
I want to plot a histogram of frequencies resp. counts, for example poisson
random numbers, on a predefined and fixed x scale
> hist(rpois(500, 2), breaks=0:10)
But instead of the frequencies I get the density of these data.
Introducing the parameter freq=TRUE then I get the frequencies but
with the following warning message
> hist(rpois(500, 2),breaks=0:10, freq=TRUE)
the AREAS in the plot are wrong -- rather use `freq=FALSE'! in:
plot.histogram(r, freq = freq, col = col, border = border, main = main,
The following excerpt from hist.default(...) (new in 1.2.2) might have caused
diddle <- 1e-07 * max(abs(range(breaks)))
fuzz <- if (right)
c(if (include.lowest) -diddle else diddle, rep(diddle,
length(breaks) - 1))
else c(rep(-diddle, length(breaks) - 1), if (include.lowest) diddle else
breaks <- breaks + fuzz
The addition of the fuzz variable to the breaks causes hist
to think of no equidistant breaks (even if they are) and therefore
a density plot is generated by default. Removing these lines the
behaviour is like the one in version 1.2.1 and earlier.
Is there an alternative doing this with the new version?
And what about the border color parameter in barplot?
Many thanks in advance
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org