Back to Data Visualization

fill

Filled 2-D polygon

Syntax

fill(X, Y)
fill(X, Y, C)
fill(..., Name, Value)

Description

Creates a filled polygon with vertices at the coordinates (X, Y). The polygon is automatically closed by connecting the last vertex to the first. Color can be specified as a short name ('r'), long name ('red'), or RGB triplet [r g b] with values in range [0,1].

Parameters

NameDescription
XX-coordinates of polygon vertices (vector)
YY-coordinates of polygon vertices (vector)
C(optional)Color specification: short name, long name, or RGB triplet
FaceColor(optional)Fill color (Name-Value pair)
FaceAlpha(optional)Fill transparency 0-1 (Name-Value pair)
EdgeColor(optional)Edge color or 'none' (Name-Value pair)
LineWidth(optional)Edge line width (Name-Value pair)
LineStyle(optional)Edge line style: '-', '--', ':', '-.', 'none' (Name-Value pair)

Returns

Graphics handle

Examples

Try It
>> fill([0 1 0.5], [0 0 1], 'r')
Try It
>> x = cos(linspace(0, 2*pi, 6));
y = sin(linspace(0, 2*pi, 6));
fill(x, y, 'b', 'FaceAlpha', 0.5)
Try It
>> fill([0 1 1 0], [0 0 1 1], [0.2 0.6 0.8], 'EdgeColor', 'none')

See Also