line

Create primitive line.

Syntax

  • go = line()

  • po = line(x, y)

  • go = line(x, y, z)

  • go = line(ax, x, y, z)

  • go = line(ax, x, y, z, propertyName, propertyValue)

Input argument

  • x, y , z - a scalar graphics object value: parent container, specified as a figure.

  • ax - Target axes: axes object.

  • propertyName - a scalar string or row vector character.

  • propertyValue - a value.

Output argument

  • go - a graphics object: line type.

Description

line(x, y) creates a line in the current axes with vectors x and y.

line(x, y, z) creates a line in three-dimensional coordinates.

Properties:

Children [] (currently not used).

Color Line color: RGB triplet, [0, 0, 0] or hexadecimal color code.

DisplayName Legend label: character vector or string scalar, '' (default).

LineStyle Line style: '--', ':', '-.', 'none' or '-' (default).

LineWidth Line width: scalar positive value.

MarkerMarker symbol: 'o' (circle), '+' (Plus sign), '*' (asterik), '.' (point), 'x' (cross), '_' (horizontal line) , '|' (vertical line), 'square', 'diamond', '^' (Upward-pointing triangle), 'v' (Downward-pointing triangle), '>' (Right-pointing triangle), '<' (Left-pointing triangle), 'pentagram', 'hexagram', 'none'(default).

MarkerEdgeColor Marker outline color: RGB triplet.

MarkerFaceColor Marker fill color: RGB triplet.

MarkerSize Marker size: scalar positive value.

Parent Parent: axes graphics object.

Tag Object identifier: string scalar, character vector, '' (default).

Type Type of graphics object: 'line'

UserData User data: array, [] (default).

Visible State of visibility: 'off' or 'on' (default).

XData x values: vector, [0 1] (default).

YData y values: vector, [0 1] (default).

ZData z values: vector, [] (default).

CreateFcnCallback (function handle, string or cell) called when object is created. Set this property on an existing component has no effect.

DeleteFcnCallback (function handle, string or cell) called when object is deleted.

BeingDeleted Flag indicating that the object is being deleted.

Examples

f = figure();
x = linspace(0,10)';
y1 = sin(x);
y2 = cos(x);
line(x, y1, 'Color', [0 1 0])
line(x, y2, 'Color', [1 0 0])
f = figure();
x = [1 9];
y = [2 12];
line(x,y,'Color','red','LineStyle','--')
f = figure();
t = linspace(0,10*pi,400);
x = sin(t);
y = cos(t);
z = t;
line(x,y,z)
view(3)

See also

plot, plot3.

History

VersionDescription

1.0.0

initial version

1.7.0

CreateFcn, DeleteFcn callback added.

--

BeingDeleted property added.

Author

Allan CORNET

Last updated