How to change the position of labels on plot?

조회 수: 82 (최근 30일)
Haya Ali
Haya Ali 2021년 10월 19일
댓글: Haya Ali 2021년 10월 19일
I want to create a distance (a little bit upward) between the data points and the labels as indicated in figure attached. Please help.
data = [1,0,3.8*10^8
2,1,4.2*10^7
3,2,1.5*10^7
4,3,7.8*10^7] ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
dy=1
f=figure;
t=tiledlayout("flow");
nexttile(t);
s=scatter3(x,y,z,'filled');
%xlabel('${\it} (A^{2}/B)^{1/4}$','Interpreter','Latex')
xlabel('${\omega}$','Interpreter','Latex')
ylabel('Y(m)')
zlabel('Y(m)')
labels=["A","B","C","D"];
text(x,y,z,labels,"HorizontalAlignment","center","VerticalAlignment","bottom");

채택된 답변

Chunru
Chunru 2021년 10월 19일
Add a number to z in "text" command.
data = [1,0,3.8*10^8
2,1,4.2*10^7
3,2,1.5*10^7
4,3,7.8*10^7] ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
dy=1
dy = 1
f=figure;
t=tiledlayout("flow");
nexttile(t);
s=scatter3(x,y,z,'filled');
%xlabel('${\it} (A^{2}/B)^{1/4}$','Interpreter','Latex')
xlabel('${\omega}$','Interpreter','Latex')
ylabel('Y(m)')
zlabel('Y(m)')
labels=["A","B","C","D"];
text(x,y,z+8e6,labels,"HorizontalAlignment","center","VerticalAlignment","bottom");

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by