【发布时间】:2012-11-12 15:35:18
【问题描述】:
我希望在 R 项目中绘制一个累积直方图,其中 Y 轴上报告的是百分比而不是频率
x <- c(rnorm(100), rnorm(50, mean=2,sd=.5))
h <- hist(x, plot=FALSE, breaks=20)
h$counts <- cumsum(h$counts)
h$density <- cumsum(h$density)
plot(h, freq=TRUE, main="(Cumulative) histogram of x", col="white", border="black")
box()
感谢您的帮助
【问题讨论】:
-
在
hist(data, freq=FALSE)中设置freq=FALSE以获得概率“百分比”而不是频率 -
是否可以用线条添加/更改条形?
标签: r plot histogram percentage