Syntax
fill(X,Y,C)
fill(X,Y,ColorSpec
)
fill(X1,Y1,C1,X2,Y2,C2,...)
fill(...,'PropertyName
',PropertyValue)
h = fill(...)
Description
The fill
function creates colored polygons.
fill(X,Y,C)
creates filled polygons from the data in X
and Y
with vertex color specified by C
. C
is a vector or matrix used as an index into the colormap. If C
is a row vector, length(C)
must equal size(X,2)
and size(Y,2)
; if C
is a column vector, length(C)
must equal size(X,1)
and size(Y,1)
. If necessary, fill
closes the polygon by connecting the last vertex to the first.
fill(X,Y,
fills two-dimensional polygons specified by ColorSpec
) X
and Y
with the color specified by ColorSpec
.
fill(X1,Y1,C1,X2,Y2,C2,...)
specifies multiple two-dimensional filled areas.
fill(...,'
allows you to specify property names and values for a patch graphics object.PropertyName
',PropertyValue)
h = fill(...)
returns a vector of handles to patch graphics objects, one handle per patch object.
Remarks
If X
or Y
is a matrix, and the other is a column vector with the same number of elements as rows in the matrix, fill
replicates the column vector argument to produce a matrix of the required size. fill
forms a vertex from corresponding elements in X
and Y
and creates one polygon from the data in each column.
The type of color shading depends on how you specify color in the argument list. If you specify color using ColorSpec
, fill
generates flat-shaded polygons by setting the patch object's FaceColor
property to the corresponding RGB triple.
If you specify color using C
, fill
scales the elements of C
by the values specified by the axes property CLim
. After scaling C
, C
indexes the current colormap.
If C
is a row vector, fill
generates flat-shaded polygons where each element determines the color of the polygon defined by the respective column of the X
and Y
matrices. Each patch object's FaceColor
property is set to 'flat'
. Each row element becomes the CData
property value for the n
th patch object, where n is the corresponding column in X
or Y
.
If C
is a column vector or a matrix, fill
uses a linear interpolation of the vertex colors to generate polygons with interpolated colors. It sets the patch graphics object FaceColor
property to 'interp'
and the elements in one column become the CData
property value for the respective patch object. If C
is a column vector, fill
replicates the column vector to produce the required sized matrix.
Examples
fill3
Filled three-dimensional polygons
Syntax
fill3(X,Y,Z,C)
fill3(X,Y,Z,ColorSpec)
fill3(X1,Y1,Z1,C1,X2,Y2,Z2,C2,...)
fill3(...,'PropertyName
',PropertyValue)
h = fill3(...)
Description
The fill3
function creates flat-shaded and Gouraud-shaded polygons.
fill3(X,Y,Z,C)
fills three-dimensional polygons. X
, Y
, and Z
triplets specify the polygon vertices. If X
, Y
, or Z
is a matrix, fill3
creates n polygons, where n is the number of columns in the matrix. fill3
closes the polygons by connecting the last vertex to the first when necessary.
C
specifies color, where C
is a vector or matrix of indices into the current colormap. If C
is a row vector, length(C)
must equal size(X,2)
and size(Y,2)
; if C
is a column vector, length(C)
must equal size(X,1)
and size(Y,1)
.
fill3(X,Y,Z,
fills three-dimensional polygons defined by ColorSpec
) X
, Y
, and Z
with color specified by ColorSpec
.
fill3(X1,Y1,Z1,C1,X2,Y2,Z2,C2,...)
specifies multiple filled three-dimensional areas.
fill3(...,'
allows you to set values for specific patch properties.PropertyName
',PropertyValue)
h = fill3(...)
returns a vector of handles to patch graphics objects, one handle per patch.
Algorithm
If X
, Y
, and Z
are matrices of the same size, fill3
forms a vertex from the corresponding elements of X
, Y
, and Z
(all from the same matrix location), and creates one polygon from the data in each column.
If X
, Y
, or Z
is a matrix, fill3
replicates any column vector argument to produce matrices of the required size.
If you specify color using ColorSpec
, fill3
generates flat-shaded polygons and sets the patch object FaceColor
property to an RGB triple.
If you specify color using C
, fill3
scales the elements of C
by the axes property CLim
, which specifies the color axis scaling parameters, before indexing the current colormap.
If C
is a row vector, fill3
generates flat-shaded polygons and sets the FaceColor
property of the patch objects to 'flat'
. Each element becomes the CData
property value for the respective patch object.
If C
is a column vector or a matrix, fill3
generates polygons with interpolated colors and sets the patch object FaceColor
property to 'interp'
. fill3
uses a linear interpolation of the vertex colormap indices when generating polygons with interpolated colors. The elements in one column become the CData
property value for the respective patch object. If C
is a column vector, fill3
replicates the column vector to produce the required sized matrix.
Examples
Create four triangles with interpolated colors.
X = [0 1 1 2;1 1 2 2;0 0 1 1];
Y = [1 1 1 1;1 0 1 0;0 0 0 0];
Z = [1 1 1 1;1 0 1 0;0 0 0 0];
C = [0.5000 1.0000 1.0000 0.5000;
1.0000 0.5000 0.5000 0.1667;
0.3330 0.3330 0.5000 0.5000];
fill3(X,Y,Z,C
)
No comments:
Post a Comment