[R] place x-axis labels at bin edges in a histogram

Rui Barradas ruipbarradas at sapo.pt
Thu Apr 4 13:10:49 CEST 2013


Try the following.

h <- hist(rnorm(100), xaxt = "n")
axis(1, at = h$breaks)

Hope this helps,

Rui Barradas

Em 04-04-2013 11:44, Shane Carey escreveu:
> Hi,
> I would like to places x-axis labels at the edge of bins on a histogram,
> i.e. the min value at first bin edge (left hand side) and max at the last
> bin edge (right hand side).
> As it stands, it places the values in the centre of each bin.
> Thanks

More information about the R-help mailing list