How to change the position of labels on plot?

71 visualizaciones (últimos 30 días)
Haya Ali
Haya Ali el 19 de Oct. de 2021
Comentada: Haya Ali el 19 de Oct. de 2021
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");

Respuesta aceptada

Chunru
Chunru el 19 de Oct. de 2021
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");

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by