xline(xvalue)
xline(xvalue, LineSpec)
xline(xvalue, LineSpec, label)
xline(xvalue, propertyName, propertyValue)
xline(ax, xvalue)
cl = xline(xvalue)
| Parameter | Description |
|---|---|
| xvalue | a real numeric scalar or vector: location of the vertical line(s) on the x-axis. |
| LineSpec | a row vector character or a scalar string: line style and color, for example '--r'. |
| label | a row vector character, a scalar string or a cell of character vectors: text displayed next to the line. |
| ax | Target axes: axes object. |
| propertyName | a scalar string or row vector character. |
| propertyValue | a value. |
| Parameter | Description |
|---|---|
| cl | a graphics object: ConstantLine type. |
xline(xvalue) draws a vertical line at the value xvalue on the current axes. The line spans the full height of the axes.
Use a LineSpec to set the line style and color, and a label to annotate the line.
When xvalue is a vector, one vertical line is created for each value.
f = figure();
plot(1:10, (1:10).^2);
xline(5, '--r', 'threshold');
f = figure();
plot(-10:10, (-10:10).^2);
xline([-3 3], 'Color', [0 0 1], 'LineWidth', 2);
| Version | Description |
|---|---|
| 2.0.0 | initial version |