Here is my code:
x = [4 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 2 3 4 3 4 2 3 4 3 4 3 4 2 3 2 3 2 3 2 3 2 3 4 3 4 3 2 4 3 4 3 2 3 2 4 2 1];y = [0 16 22 27 29 31 39 40 42 46 49 51 53 62 71 77 86 96 99 104 106 107 109 111 114 116 118 119 121 124 127 130 164 174 182 202 221 225 226 227 230 256 269 278 306 342 352 362 371 421 484 498 712 760 764 772 804];stairs(x,y);set(gca, 'YDir', 'reverse')xlim([0 5])ylim([0 805])grid on
Here is the figure:
I would like to know how to fill color inside the staris lines. So, for example, if x = 4, fill blue. If x = 3, fill color green. If x = 2 fill color red. If x = 1, fill color yellow.
Any help will be appreciated. Thank you!
Best Answer