Plot vertical and horizontal reference lines
Updated 19 Apr 2007

View License

REFLINEXY(X,Y) plots vertical and horizontal reference lines. The vertical set of lines are drawn from the bottom of the axes up to each point Y at the positions X. The horizontal set of lines are drawn from the left of the axes to each point X at the positions Y.
REFLINEXY(X,Y,XOFFSET) uses the value XOFFSET as the vertical offset for the vertical lines. REFLINE(X,Y,XOFFSET,YOFFSET) uses the value YOFFSET as the horizontal offset for the horizontal lines. If the offsets are omitted, or if they are empty, the defaults are used, namely the bottom and/or the left side of the axis, respectively. The offsets can be specified for each point separately.
The lines are plotted as a two graphics object. H = XYREFLINE(..) returns the two graphics handles of the vertical and horizontal line objects.
REFLINEXY(..., 'Prop1','Val1','Prop2','Val2', ...) uses the properties and values specified for color, linestyle, etc. Execute GET(H), where H is a line handle, to see a list of line object properties and their current values. Execute SET(H) to see a list of line object properties and legal property values.
REFLINEXY uses the current axes, if any. Lines outside the plot area are plotted but not shown.

% some data
N = 1000 ; i=0:N ;
x = (i/N) * 4 * pi ; y = exp(i/N) .* sin(x) ;
plot(x,y,'b-') ;
% add specific reference lines
i0 = [100 400 600] ;
reflinexy(x(i0),y(i0),'color','r') ;
% other reference lines with a specific offset
h = reflinexy(1:14,linspace(-2,1.5,14),[],x(end)-2) ;
set(h,'color','g','linestyle','-','linewidth',3) ;

and GRIDXY (on the FEX)

version 1.2 (april 19th, 2007)

Cite As

Jos (10584) (2024). REFLINEXY (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: GRIDXY

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Changed input to uistack into column vector. Added warning message identifier.