根据矩阵中的位置着色条形图的某些部分

时间:2016-12-01 10:10:12

标签: r colors bar-chart

My barplot as it is now

这是一个非常直截了当的问题,但我很难找到执行此任务的代码。我在这里设置了四种不同的育种方案。我希望值[248:301]为一种颜色,[302:356]为另一种颜色,[357:428]为另一种颜色,[429:500]为第四种颜色。 R(工作室)的代码是什么?

u_pred <- bu_pred[248:500]
u_pred
barplot(u_pred, xlab = "Individual", ylab = "Breeding value")

1 个答案:

答案 0 :(得分:0)

col的{​​{1}}参数可以采用向量。例如:

barplot

enter image description here