检查col参数和直方图breaks属性.见下面的例子:
set.seed(0)
x = rnorm(100, mean=0.5, sd=0.5)
h = hist(x, breaks=10, plot=F)
colors = rep("blue", length(h$breaks))
colors[h$breaks >= 0.3] = "red"
colors[h$breaks >= 0.5] = "green"
colors[h$breaks >= 0.7] = "orange"
hist(x, breaks=10, col=colors)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
991 次 |
| 最近记录: |