applying multiple colormaps on one barchart using a for loop
1 次查看(过去 30 天)
显示 更早的评论
I have one set of data in a barchart which I wish to assign 4 different colormaps to if possible. in the matrix, I have R1 (blue), R2-11 (bone), R12 (red), R13-22 (copper) but im unsure how to assign these colours and was hoping to use a for loop with if statements to do it.
0 个评论
采纳的回答
KARSH THARYANI
2018-6-21
编辑:KARSH THARYANI
2018-6-21
Possibly it could be something like this without using a for-loop:
b = rand(10, 1);
graph = bar(b);
graph.FaceColor = 'flat';
graph.CData(1:5, :) = repmat([0 1 0], 5, 1);
graph.CData(6:10, :) = repmat([1 0 0], 5, 1);
2 个评论
Walter Roberson
2018-6-25
2:11 is 10 rows, but you are trying to store only 5 rows into it. The 5 in the repmat in the example is the row count.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!