Suppose we have a matrix I of size 49x49x5, corresponding to 5 images of size 49x49 stacked along the third dimension so we have a total of 5 images. These images should vis
The function you're looking for is the patch function. By way of example:
x=[1 1 6]; y=[2 7 2]; z=[1 1 -1];
This specifies a triangle (three points), and the coordinates of the vertices are (1,2,1)
, (1,6,1)
, and (6,2,-1)
. If you would add a fourth point to each vector it would be a rectangle, with the new vertex at the new x,y,z coordinate.
To answer your posted question directly, you can plot a number of rectangles for each variable simply by using a multidimensional array for x
, y
, and z
, where each column specifies a different polygon. In practice, this works as follows:
% plot two rectangles
x = [1 1 1 1;
1 1 1 1;
4 4 4 4;
4 4 4 4;];
y = [1 1 1 1;
2 2 2 2;
2 2 2 2;
1 1 1 1;];
z = [1 2 3 4;
1 2 3 4;
1 2 3 4;
1 2 3 4;];
patch(x,y,z,'w');
Which makes:
There are options you can use to add color to the polygons, check the docs.