Exact number of bins in Histogram in R

后端 未结 5 1064
Happy的楠姐
Happy的楠姐 2020-12-01 08:24

I\'m having trouble making a histogram in R. The problem is that I tell it to make 5 bins but it makes 4 and I tell to make 5 and it makes 8 of them.

data &l         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 09:04

    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

提交回复
热议问题