# Limit Lines/Plane on a 3D Plot

조회 수: 18(최근 30일)
Sclay748 2021년 1월 20일
답변: KSSV 2021년 1월 20일
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)

댓글을 달려면 로그인하십시오.

### 답변(1개)

KSSV 2021년 1월 20일
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)
hold on
plot3(P(:,1),P(:,2),P(:,3))

댓글을 달려면 로그인하십시오.

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by