Matlab - a 2D rectangle chart with interpolated color

I want to build a 2d rect (using the function rectanglewell enough for my needs), but with a linearly interpolated color, that is, at the bottom it should be red, in the top blue and there should be a linear interpolation of the two colors between the two. How can i do this?

+3
source share
1 answer

A patch is the answer. In fact, you can use it on any polygon 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))
+5
source

Source: https://habr.com/ru/post/1762134/


All Articles