我有一个每个数字0:9的概率表,数据如下所示:
0 1 2 3 4 5 6 7 8 9
0.0905 0.1065 0.1035 0.0945 0.0975 0.1025 0.1000 0.0985 0.1010 0.1055
如果我对数据运行直方图,它按概率分组,当我希望按表名(数字)分组的表格然后让条形显示概率。当前的直方图如下所示:
答案 0 :(得分:0)
技术上不对,但你可以伪造直方图:
x <- rbind(c(0.0905, 0.1065, 0.1035, 0.0945, 0.0975, 0.1025, 0.1000, 0.0985, 0.1010, 0.1055))
colnames(x) <- 0:9
barplot(x, space = 0, #sets space between bars to zero as in a histogram
ylab = "Probabilities" , xaxt='n') #supress labels of x-axis
axis(1, at = colnames(x), labels = colnames(x)) # add custom axis and labels to look like histogram
box()