Home > front end >  how to add a bar specifying number of each color in a colored matrix in matlab?
how to add a bar specifying number of each color in a colored matrix in matlab?

Time:05-23

i have a matrix that i colored in green/blue/white according to the values in the cell of each matrix (1-green , 2-blue , 0-white)

i want to add a bar to the graph that specifys how much green and blue cells there are.

this is how i colored the matrix :

figure;
hp = pcolor(padarray(MY_MATRIX(:,:,1),[1 1],'replicate','post'));
hp.EdgeColor = [0 0 0];
hp.LineWidth = 2;
colormap([1 1 1;0 1 0;0 0 1;]);

i want to have something like this maybe:

green-25

blue-13

thank you in advance.

CodePudding user response:

enter image description here

  • Related