How to create a distance between labels in plot?

3 Ansichten (letzte 30 Tage)
Haya Ali
Haya Ali am 13 Jan. 2022
Kommentiert: Haya Ali am 17 Jan. 2022
How to separate the mixed labels? As show in figure. Below is my code.
clear all; close all; clc;
data=[0.0245,0.1200,0
0.0179,0.2700,4.1000
0.0224,0.2700,5.5000
0.0189,0.1000,3.3000
0.0219,0.1000,0.8000
0.0184,0.3500,0
0.0233,0.1000,2.7000
0.0230,0.1800,4.7000
0.0228,0.1800,4.7000
0.0185,0.2700,3.8000
0.0200,0.2700,4.4000
0.0182,0.2700,1.5000
0.0185,0.2700,4.7000
0.0203,0.1000,0
0.0171,0.1800,4.7000
0.0214,0.2700,1.8000
0.0199,0.3500,0
0.0202,0.2700,4.1000
0.0219,0.1200,5.4000
0.0196,0.3500,0
%0.0203,0.1000,0
0.0198,0.3500,0
0.0208,0.0700,0
];
x = data(:,1);
y = data(:,2);
z = data(:,3);
dz=1;
f=figure;
%t=tiledlayout("flow");
%nexttile(t);
h=scatter3(x,y,z,100,'filled','MarkerEdgeColor','k');
C = jet(numel(x));
h.CData = C;
set(gca, 'colormap', C)
colorbar()
%xlabel('${\it} (A^{2}/B)^{1/4}$','Interpreter','Latex')
xlabel('${\alpha }$','Interpreter','Latex')
ylabel('${\omega }$','Interpreter','Latex')
zlabel('${\varphi}$','Interpreter','Latex')
labels=["d1","d2","d3","d4","d5","d6","d7","d8","d9","p1","p2","p3","p4","v1,v8","v2","v3","v4","v5","v6","v7","v9","v10"];
text(x,y,z+dz,labels,"HorizontalAlignment","center","VerticalAlignment","bottom",'FontSize',10);

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 13 Jan. 2022
hello haya
I have introduced a bit of randomness in the dz so that the labels will be a different heights
dz = 0.2+0.5*rand(size(z));
of course you can adapt the fixed and variable amplitudes so it best matches your expectations
clear all; close all; clc;
data=[0.0245,0.1200,0
0.0179,0.2700,4.1000
0.0224,0.2700,5.5000
0.0189,0.1000,3.3000
0.0219,0.1000,0.8000
0.0184,0.3500,0
0.0233,0.1000,2.7000
0.0230,0.1800,4.7000
0.0228,0.1800,4.7000
0.0185,0.2700,3.8000
0.0200,0.2700,4.4000
0.0182,0.2700,1.5000
0.0185,0.2700,4.7000
0.0203,0.1000,0
0.0171,0.1800,4.7000
0.0214,0.2700,1.8000
0.0199,0.3500,0
0.0202,0.2700,4.1000
0.0219,0.1200,5.4000
0.0196,0.3500,0
%0.0203,0.1000,0
0.0198,0.3500,0
0.0208,0.0700,0
];
x = data(:,1);
y = data(:,2);
z = data(:,3);
dz = 0.2+0.5*rand(size(z));
f=figure;
%t=tiledlayout("flow");
%nexttile(t);
h=scatter3(x,y,z,100,'filled','MarkerEdgeColor','k');
C = jet(numel(x));
h.CData = C;
set(gca, 'colormap', C)
colorbar()
%xlabel('${\it} (A^{2}/B)^{1/4}$','Interpreter','Latex')
xlabel('${\alpha }$','Interpreter','Latex')
ylabel('${\omega }$','Interpreter','Latex')
zlabel('${\varphi}$','Interpreter','Latex')
labels=["d1","d2","d3","d4","d5","d6","d7","d8","d9","p1","p2","p3","p4","v1,v8","v2","v3","v4","v5","v6","v7","v9","v10"];
text(x,y,z+dz,labels,"HorizontalAlignment","center","VerticalAlignment","bottom",'FontSize',10);

Weitere Antworten (0)

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by