<< parula | Graphics functions | pcolor >> |
patch(X, Y, C) |
patch(X, Y, Z, C) |
patch('XData', X, 'YData', Y) |
patch('XData', X, 'YData', Y, 'ZData', Z) |
patch('Faces', F, 'Vertices', V) |
patch(S) |
patch(..., propertyName, propertyValue) |
patch(ax, ...) |
go = patch(...) |
x-coordinates: vector or matrix.
y-coordinates: vector or matrix.
z-coordinates: vector or matrix.
Color array: scalar, vector, m-by-n-by-3 array of RGB triplets.
a scalar graphics object value: parent container, specified as a axes.
a scalar string or row vector character.
a value.
a structure with fields that correspond patch property names and field values.
a graphics object: patch type.
patch(X, Y, C) creates a 2D polygonal shape with vertices defined by X and Y coordinates, and fills the shape with color C.
patch(X, Y, Z, C) creates a 3D polygonal shape with vertices defined by X, Y, and Z coordinates, and fills the shape with color C.
patch(..., PropertyName, PropertyValue, ...) sets optional properties for the patch object using name-value pairs.
patch('Faces', F, 'Vertices', V) creates one or more polygons .
go = patch(...) returns the handle go to the created patch object.
Property Name-Value Pairs:
'FaceColor': color of the filled shape. FaceColor can be a character vector or a 3-element RGB vector. Default: 'flat'.
'EdgeColor': color of the edges of the polygonal shape. EdgeColor can be a character vector or a 3-element RGB vector. Default: 'none'.
'LineWidth': width of the edges of the polygonal shape. Default: 0.5.
'LineStyle': style of the edges of the polygonal shape. LineStyle can be a character vector or a line style code. Default: '-'.
'FaceAlpha': transparency of the filled shape. FaceAlpha can be a scalar between 0 and 1. Default: 1.
'EdgeAlpha': transparency of the edges of the polygonal shape. EdgeAlpha can be a scalar between 0 and 1. Default: 1.
'Parent': handle of the parent object for the patch. Default: gca().
'Vertices': matrix of vertex coordinates. The matrix must have size N-by-2 or N-by-3, where N is the number of vertices. Default: the vertex coordinates are specified by the X, Y, and Z input arguments.
fig = figure('Color', 'k');
ax.Color = 'k';
f=0.1;
t=0:f^2:2*pi;
r=pi/4;
p=r*t+r;
patch([cos(p), 0], [sin(p), 0], 'y');
c = eye(3);
for a=2:2:6
patch([t/4+a, a+r*(1+cos(t/2)),a], [-f*cos(3*(a+t))-r,r*sin(t/2),-1], c(a/2,:));
patch(a +f*cos(t)'+r./[1,0.65], f*(2+sin(t)').*[1,1], 'k', 'EdgeColor', 'w', 'LineWidth', pi)
end
axis equal
axis off
f =figure('Color', 'w');
x = [-1 1 0 -1];
y = [-1/sqrt(3) -1/sqrt(3) 2*sqrt(3)/3 -1/sqrt(3)];
plot(x,y,'k','LineWidth',3);
t = 0:0.001:2*pi;
xc = cos(t)/3+x';
yc = sin(t)/3-y';
for i = 1:3
patch(xc(i,:),yc(i,:),'k');
end
patch(x,-y,'w','EdgeColor','w');
axis('equal')
axis('off')
Nerfertiti 3D mask
nefertiti_directory = [modulepath('graphics', 'root'), '/examples/nefertiti-mask/'];
load([nefertiti_directory, 'nefertiti-mask.nh5']);
figure('Color', [1, 1, 1]);
patch('Faces', Faces, 'Vertices', Vertices, 'FaceVertexCData', Colors, ...
'EdgeColor', 'none', ...
'FaceColor', 'interp', 'FaceAlpha', 1);
axis equal
axis off
view([0, 0, 1]);
Alpha channel
x = [1 3 4 3 1 0];
y = [0 0 2 4 4 2];
z = [0 0 0 0 0 0];
figure();
hold on
patch(x,y,z,'cyan','FaceAlpha',0.3)
patch(x+2,y,z,'magenta','FaceAlpha',0.3)
patch(x+1,y+2,z,'yellow','FaceAlpha',0.3)
Version | Description |
---|---|
1.0.0 | initial version |
Allan CORNET