How to change the position of labels on plot?
72 次查看(过去 30 天)
显示 更早的评论
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");
0 个评论
采纳的回答
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
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 Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!