ContentsIndexReferenceHome
PreviousUpNext
vline
MATLAB
h = vline([ax], x, [linetype], [lbl])
Description

Draws a vertical line on the current axes at the location specified by x. The line is held on the current axes, and after plotting the line, the function returns the axes to its prior hold state. The HandleVisibility property of the line object is set to "off", so not only does it not appear on legends, but it cannot be found by using findobj. Specifying an output argument causes the function to return a handle to the line, so it can be manipulated or deleted.

Parameters
Parameters 
Description 
ax [handle] 
(Optional) Axis handle. Defaults to current axes. 
x [vector] 
X-axis values for vertical lines 
linetype [char/cell] 
(Optional) Simple line spec for the line color, style and symbol. Defaults to 'r:'. Can pass in a cell array of strings if x is a vector. 
lbl [char/cell] 
(Optional) Text label for each line. Will be the same color as the line. If not passed in, lines will have no label. 
Return Values
Return Values 
Description 
h [handle] 
Handles for each line plotted 
Examples

>> h = vline(42,'g','The Answer') 

  • Returns a handle to a green vertical line on the current axes at x=42, and creates a text object on the current axes, close to the line, which reads "The Answer".
>> vline([4 8 12],{'g','r','b'},{'l1','lab2','LABELC'}) 

  • Draws three lines with the appropriate labels and colors.
 

See Also
Group
Made with Doc-O-Matic.
Copyright (c) 2009. All rights reserved.
What do you think about this topic? Send feedback!