我有以下R代码:
library(extraDistr)
x <- rdunif(100, 1, 6)
barplot(x, xlab="x", ylab="P(X=x)", ylim=c(0, 0.2))它会生成如下所示的图:

但我想要一个看起来像这样的图(但条形图具有相同的高度(都是1/6)和xlim=c(1,6)):

我怎样才能做出我想要的图呢?
发布于 2019-10-21 23:34:19
你需要做barplot(prop.table(table(x)))
https://stackoverflow.com/questions/58489539
复制相似问题