[Rd] hist (PR#4395)

Duncan Murdoch dmurdoch at pair.com
Thu Oct 2 17:08:38 MEST 2003

On Thu, 2 Oct 2003 20:48:33 +0200 (MET DST), mittal at math.arizona.edu
wrote :

>It is not really a bug but a strange choice.

Please don't post discussion to r-bugs.  Each post to r-bugs ends up
in the bug repository, and requires manual handling.

> When the option freq=F chosen, hist
>should plot relative frequency. It plots proportional to relative frequency by
>the factor of bin width. Is there a reason for this? A more normal choice seems
>to be to have it independent of the bin width. 

No, that would result in misleading plots.  For example, if one bar is
twice as wide as another but they are the same height, then the
natural interpretation is that the wide bar represents twice as many
observations, or twice the probability.  This is the way densities
work, and is how histograms should work.  (However, since not everyone
interprets histograms this way, it's safest not to use variable width

If you just want to plot some bars where the area of the bar has no
meaning, use barplot() instead of hist().

Duncan Murdoch

More information about the R-devel mailing list