使用R进行数据可视化套路之-直方图

来源:互联网 发布:工业机器人控制软件 编辑:程序博客网 时间:2024/05/01 23:45

代码

library(DAAG)attach(fossum)par(mfrow = c(1,3))hist(totlngth, breaks = 72.5 + (0:5) * 5, ylim = c(0, 22), xlab="Total length (cm)", main ="A: Breaks at 72.5, 77.5, ...")dens <- density(totlngth)xlim <- range(dens$x)ylim <- range(dens$y)hist(totlngth, breaks = 72.5 + (0:5) * 5, probability = T, xlim = xlim, ylim = ylim, xlab="Total length (cm)", main=" ")lines(dens)hist(totlngth, breaks = 75 + (0:5) * 5, probability = T, xlim = xlim, ylim = ylim, xlab="Total length (cm)", main= " ")lines(dens)detach(fossum)

效果


原创粉丝点击