MATLAB: How to fill only half of the rectangle with any color

colorcolormapfillrectangle

How to fill only half of the rectangle with any color?

Best Answer

Something which I would try is to fill the entire rectangle A.
Modify the rectangle A's position properties to be halved (depending on which half). Now create a second rectangle B which is transparent (no fill) to start from the boundary of rectangle A.
Now you'll have two rectangles. However, it gives an illusion that it is a single rectangle in your application / use case.
Related Question