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

代码

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)

效果

使用R进行数据可视化套路之-直方图_第1张图片

你可能感兴趣的:(R,Processing)