[R] Histogram with uneven bins
jholtman at gmail.com
Thu Apr 19 19:39:02 CEST 2007
will this work for you?
x <- runif(1000, 0, 40)
x.c <- cut(x, breaks=c(0, 1, 3, 6, 10, Inf))
On 4/19/07, mtb954 at gmail.com <mtb954 at gmail.com> wrote:
> Hi R-helpers
> I would like to produce a histogram with uneven bins (e.g., 0, 1-2, 3-5,
> 6-10, 10-20, >20) but I would like the resulting bars to be the same width (
> i.e., a bar's width would not be proportional to its corresponding bin
> Also, the x and y axes of my histograms frequently (almost always, actually)
> extend beyond the axis labels (i.e., there are unlabeled bars). I would like
> to label each bar exactly with the range of values that corresponds to it (
> i.e., print a "0" underneath the 0 bin, print "1-2) underneath the 1-2 bin,
> I'd appreciate any help you might be able to provide, thanks!
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help