R直方图图中每个箱中的实例数(R histogram number of instances in each bin on plot)
我想看到每个bin的实例数量也显示在图表上
set.seed(1) x<-rnorm(1:100) hist(x)I would like to see the number of instances for each bin show up on the graph as well
set.seed(1) x<-rnorm(1:100) hist(x)最满意答案
试试这个
set.seed(1) x<-rnorm(1:100) y <- hist(x, plot=FALSE) plot(y, ylim=c(0, max(y$counts)+5)) text(y$mids, y$counts+3, y$counts, cex=0.75)这使:
Try this
set.seed(1) x<-rnorm(1:100) y <- hist(x, plot=FALSE) plot(y, ylim=c(0, max(y$counts)+5)) text(y$mids, y$counts+3, y$counts, cex=0.75)which gives:
更多推荐
发布评论