I have the following 10 x 3 matrix:
1 3.43 0.80
2 3.24 0.10
3 3.20 0.60
4 3.15 0.90
5 3.07 0.70
6 2.82 1.00
7 2.76 0.50
8 2.62 0.70
9 2.61 0.60
10 2.55 0.90
I want to plot this as a bar chart using the first 2 columns, but assign colors to each bar based on its value in the 3rd column, using some form of a colormap, such that the color of each bar reflects the value in the 3rd column.
I can get this far easily:
>> x=matrix(:,1);>> y=matrix(:,2);>> bar(x,y)
to get this figure, no problem:
But how do I now change the color of each bar based on its corresponding value in the 3rd column of the matrix, using a colormap?
Best Answer