Exact number of bins in Histogram in R

Use the breaks argument:

hist(data, breaks=seq(0,80,l=6),
       freq=FALSE,col="orange",main="Histogram",
       xlab="x",ylab="f(x)",yaxs="i",xaxs="i")

enter image description here

Leave a Comment