Clear Filters
Clear Filters

Limit Lines/Plane on a 3D Plot

13 views (last 30 days)
Sclay748
Sclay748 on 20 Jan 2021
Answered: KSSV on 20 Jan 2021
Hello, I am trying to add a limit line to my 3D plot.
If I was in 2D, I would just use xline or yline to throw a line on the graph with a label.
How would I do that for 3D? Is there a way to generate an easy plane to show my limits for all 3 axis?
Thanks!
This is what I would do if it was 2D. I need the 3D equivalent that encorporates all axis.
xline(123, 'k', 'Label1 )
yline(123, 'b', Label2)

Answers (1)

KSSV
KSSV on 20 Jan 2021
In 3D your (x,y) points remain same on the line and your z coordinate will vary. You can write a small function for you need.
Example
[X,Y,Z] = peaks(50) ;
n = 10 ;
x = 0 ; y = 0 ; % want line passing throuh (0,0) and parallel to z axies
P = [repmat(x,10,1) repmat(y,10,1) (0:9)'] ;
surf(X,Y,Z)
shading interp
hold on
plot3(P(:,1),P(:,2),P(:,3))

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!