File Exchange

image thumbnail


version (3.16 KB) by Jos (10584)
Plot 3D reference lines to the YZ-, XZ- and XY-planes


Updated 09 Oct 2007

View License

REFLINEXYZ(X,Y,Z) plots reference lines from the 3D points (X,Y,Z) to the three cartesian planes (YZ, XZ, & XY planes). The lines are drawn from the axes planes upto each point. X, Y and Z should have the same number of elements.

REFLINEXYZ(X,Y,Z,YZOFFSET, XZOFFSET, XYOFFSET) specifies the offset from the three planes. If an offset is omitted (or empty), the defaults are used, namely the lower limits of each axis. The offsets can be scalars, specifying the same offset for each point, or vectors with the same number of elements as the points, to specify the offset for each point individually.

The lines are plotted as a three graphics object. H = REFLINEXYZ(..) returns the three graphics handles of the lines to the YZ, XZ and XY planes in H.

REFLINEXYZ(..., '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.

REFLINEXYZ uses the current axes, if any. Lines outside the plot area are plotted but not shown.

See also stem, plot3, refline, grid, axes
and gridxy and reflinexy (on the FEX)

Cite As

Jos (10584) (2021). REFLINEXYZ (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)


Oh, I missed this section after pause. Now it works like a charm! Thanks a lot!

Jos (10584)


The shadowed line is added in the third section of the example (note that I have added a pause statement after the second section, so you have to press a key). The third section reads:
% make a projection to xy-plane
hold on ; plot3(x,y,zeros(size(x)),'k.-') ; hold off ;
h = reflinexyz(x,y,z,'color','k','linestyle','-') ;
delete(h([1 2])) ; % delete the yz and xz projections
title ('Projection to XY plane') ;

I hope this works for you.


A very nice tool! But a short question for the example. In the logo of this function (in the upper left corner of this page) you managed to draw also the shadowed line into the xy plane, the example comes without the plot in the xy plane. Could you please provide the full example which created the logo file?? - 1000 thanks!!!

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

Community Treasure Hunt

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

Start Hunting!