fill
Draws filled 2-D polygons from vertex coordinates.
Category: Graphics > 2-D and 3-D Plots
Syntax
fill(X, Y, C)
Fills the polygon with vertices (X(k), Y(k)) using the color C.
fill(X, Y, ColorSpec)
Uses a color letter such as 'r' or an RGB triplet.
fill(___, Name, Value)
Sets patch properties such as 'FaceAlpha' or 'EdgeColor'.
h = fill(___)
Also returns the patch handles.
Description
The polygon is closed automatically by joining the last vertex to the first. Use fill to shade the area between curves or to draw simple shapes; to shade under a single curve area is shorter.
Input arguments
X, Y- Vertex coordinates. If they are matrices, each column is a separate polygon.
C- Color: a color letter, an RGB triplet, or one value per vertex to be mapped through the colormap.
Output arguments
h- Patch handles, one per polygon.
Example
Area between two curves
x = linspace(0, pi, 50);
fill([x fliplr(x)], [sin(x) fliplr(0.5*sin(x))], [0.6 0.8 1])
In the app, the figure is drawn below the code.