Effacer les filtres
Effacer les filtres

How to change the position of labels on plot?

56 vues (au cours des 30 derniers jours)
Haya Ali
Haya Ali le 19 Oct 2021
Commenté : Haya Ali le 19 Oct 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");

Réponse acceptée

Chunru
Chunru le 19 Oct 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");

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by