fill

Purpose

Filled 2-D polygons.

Synopsis

fill(X,Y,C)
fill(X1,Y1,C1,X2,Y2,C2,...)

Description

fill(X,Y,C) fills the two-dimensional polygon defined by vectors X and Y with the color specified by C. The vertices of the polygon are specified by pairs of components of X and Y. If necessary, the polygon is closed by connecting the last vertex to the first.

If C is a single character string chosen from the list 'r','g','b', 'c','m','y','w','k', or a red- green-blue row vector triple, [r g b], the polygon is filled with the constant specified color.

If C is a vector the same length as X and Y, its elements are scaled by caxis and used as indices into the current colormap to specify colors at the vertices; the color within the polygon is obtained by bilinear interpolation of the vertex colors.

If X and Y are matrices of the same size, fill(X,Y,C) draws one polygon per column. In this case, C is a row vector for flat polygon colors, and C is a matrix for interpolated polygon colors.

If either X or Y is a matrix, and the other is a column vector with the same number of rows, the column vector argument is replicated to produce a matrix of the required size.

fill(X1,Y1,C1,X2,Y2,C2,...) is another way of specifying multiple filled areas.

fill sets the patch object FaceColor property to 'flat', 'interp', or a ColorSpec depending upon the value of the C matrix.

fill returns a column vector of handles to patch objects, one handle per patch. The X, Y, C triples can be followed by parameter/value pairs to specify additional properties of the patches.

Examples

Create a red STOP sign (without the lettering).

t = (1/16:1/8:1)'*2*pi;
x = sin(t);
y = cos(t);
fill(x,y,'r')
axis square

See Also

colormap, fill3, patch 

(c) Copyright 1994 by The MathWorks, Inc.