开发者

matlab - plot 2D rectangle with interpolated color

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 botto开发者_如何学运维m 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?


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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜