Create vectors to hold the x- and y-locations of vertices, feed these into patch
.
X=rand(1,4); Y=rand(1,4);
h=patch(X,Y,'red');
Each polygon's vertices occupy one column of each of X
, Y
.
X=rand(4,3); Y=rand(4,3);
for i=2:3
X(:,i)=X(:,i)+(i-1); % create horizontal offsets for visibility
end
h=patch(X,Y,'red');