FUNCTION REFERENCE

patch

Draw filled polygons.

Draw filled polygons.

Syntax

p = patch(x, y, c)

Syntax

p = patch(x, y, c, Name, Value, ...)

Syntax

p = patch(x, y, z, c, ...)

Syntax

p = patch('XData', x, 'YData', y, 'FaceColor', color, 'EdgeColor', edge)

Syntax

p = patch(ax, ...)

Syntax

p = patch(s)

Syntax

p = patch('Faces', f, 'Vertices', v, 'FaceVertexCData', c)

Draws triangles or axis-aligned quadrilaterals with corners (x, y) in the given axes or current axes. Supports color letters/names/RGB or 'none', plus FaceAlpha, EdgeColor, EdgeAlpha, LineStyle, LineWidth, DisplayName and Visible. XData, YData and ZData can be updated with set(p, ...) to rebuild Faces and Vertices.

Patch and surface support FaceLighting, EdgeLighting, BackFaceLighting, AmbientStrength, DiffuseStrength, SpecularStrength, SpecularExponent and SpecularColorReflectance through get/set and dot syntax.

An isosurface or isocaps struct defines indexed 3-D triangles. Faces contain one-based vertex indices and FaceVertexCData, when supplied, contains a scalar per vertex. Indexed faces and edges default to black. Use FaceColor 'flat' or 'interp' to map FaceVertexCData through the axes colormap and color limits.

Example

a = gca; p = patch(a, 'XData', [0;1;0], 'YData', [0;0;1], 'FaceColor', [1 0 0], 'EdgeColor', 'none'); get(p, 'Type')   % 'patch'

Example

p = patch('Faces',[1 2 3],'Vertices',[0 0 1;1 0 1;0 1 2],'FaceVertexCData',[0;.5;1],'FaceColor','interp'); view(3);

Example

p = patch([0 1 1], [0 0 1], 'g', 'FaceAlpha', 0.3); p.FaceAlpha   % 0.3

Differences from MATLAB: Lighting properties are stored but do not affect rendering. patch(x,y,c) supports triangles and axis-aligned quadrilaterals. The XData/YData name-value form requires explicit FaceColor and EdgeColor. Indexed faces must be triangles, Vertices must have three columns, and FaceVertexCData supports one scalar per vertex. Interpolated faces use one averaged color per triangle.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.