Reputation: 24991
I want to plot a 2d rect (using the rectangle
function is good enough for my needs), but with a linearly interpolated color, i.e at the bottom it should be red, at the top blue, and between the two there should be the linear interpolation of the two colors.
How can I do this?
Upvotes: 3
Views: 2918
Reputation:
Patch is the answer. In fact, you can use it on any polygonal patch.
patch([0 0 1 1],[0 2 3 0],reshape([0 0 0;1 1 1;0 1 0;1 0 0],4,1,3))
Upvotes: 5