Skip to content

drawPolyline

David Legland edited this page Feb 28, 2022 · 1 revision

Draw a polyline specified by a list of points.

Usage

drawPolyline(COORD);

packs coordinates in a single [N*2] array.

drawPolyline(PX, PY);

specifies coordinates in separate arrays. PX and PY must be column vectors with the same length.

drawPolyline(..., TYPE);

where TYPE is either 'closed' or 'open', specifies if last point must be connected to the first one ('closed') or not ('open'). Default is 'open'.

drawPolyline(..., PARAM, VALUE);

specify plot options as described for plot command.

H = drawPolyline(...) 

also return a handle to the list of line objects.

Examples

Draw a curve representing an ellipse

t = linspace(0, 2*pi, 100)';
px = 10*cos(t); py = 5*sin(t);
drawPolyline([px py], 'closed');
axis equal;

The same, with different drawing options

drawPolyline([px py], 'closed', 'lineWidth', 2, 'lineStyle', '--');

See Also

polygons2d, drawPolygon

Clone this wiki locally