xline

Add one or more vertical lines in the current axes or specified axes.

Syntax

h = xline(x)

h = xline(..., property, value, ...)

h = xline(hAxes, ...)

Inputs

x
Constant point x of vertical line.
Type: double | integer
Dimension: scalar | vector
property
Properties that control the appearance or behavior of the graphics object.
Type: string
Dimension: scalar
value
Value of the properties.
Type: double | integer | string
Dimension: scalar | vector
hAxes
Axis handle.
Type: double
Dimension: scalar

Outputs

h
Handle of the line graphics object.

Examples

Simple xline example:
clf;
h = xline(4);
Figure 1. Vertical line at x = 4
Create vertical lines and set properties example:
clf;
x=[0:0.1:3*pi];
plot(x, sin(x)); 
h = xline([1;9],'color','k','linestyle','--');
Figure 2. Create 2 lines and set properties

Comments

If there is no axis, one is created first. If x is an Mx1 matrix, then M vertical lines are created.

If an axis exists, lines are added to it without clearing existing lines.