Hello,
I am trying to find a way to make the results of my 3D plot more visible. I see two ways to do that: make a border to different datasets or to make z-axes values distribution as a bacground in 2D image of x and y? Do you have an idea how to do that?
Now I have this dataset, which gives points on 3D graph.
Thanks for your help.
x1 = [1.15 1.24 1.19];
y1 = [191.00 187.90 173.30];
z1 = [168.70 175.70 155.10];
scatter3(x1,y1,z1)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x2 = [1.18 1.35 1.34];
y2 = [207.20 210.40 188.80];
z2 = [183.60 201.90 184.60];
scatter3(x2,y2,z2)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
scatter3(x3,y3,z3)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
scatter3(x3,y3,z3)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x4 = [0.65 0.76 0.74];
y4 = [394.73 146.90 428.90];
z4 = [196.30 236.60 273.70];
scatter3(x4,y4,z4)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x5 = [0.59 0.98 1.25];
y5 = [327.90 309.10 363.00];
z5 = [156.40 221.70 317.30];
scatter3(x5,y5,z5)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x6 = [0.54 0.60 0.79];
y6 = [308.80 244.20 245.70];
z6 = [133.60 109.70 156.10];
scatter3(x6,y6,z6)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on

답변 (1개)

Cris LaPierre
Cris LaPierre 2022년 1월 28일

2 개 추천

What about a stem3 plot?
x1 = [1.15 1.24 1.19];
y1 = [191.00 187.90 173.30];
z1 = [168.70 175.70 155.10];
stem3(x1,y1,z1)
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
hold on
x2 = [1.18 1.35 1.34];
y2 = [207.20 210.40 188.80];
z2 = [183.60 201.90 184.60];
stem3(x2,y2,z2)
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
stem3(x3,y3,z3)
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
stem3(x3,y3,z3)
x4 = [0.65 0.76 0.74];
y4 = [394.73 146.90 428.90];
z4 = [196.30 236.60 273.70];
stem3(x4,y4,z4)
x5 = [0.59 0.98 1.25];
y5 = [327.90 309.10 363.00];
z5 = [156.40 221.70 317.30];
stem3(x5,y5,z5)
x6 = [0.54 0.60 0.79];
y6 = [308.80 244.20 245.70];
z6 = [133.60 109.70 156.10];
stem3(x6,y6,z6)
hold off

댓글 수: 4

Mariia Arseenko
Mariia Arseenko 2022년 1월 28일
That is already much better, thanks!
The issue for me here that the groups are still not easy to distinguish directly when you see them. Also because randomisation for some values is quite high.
What about a 2D scatter plot where the marker color is determined by the Z value?
x1 = [1.15 1.24 1.19];
y1 = [191.00 187.90 173.30];
z1 = [168.70 175.70 155.10];
x2 = [1.18 1.35 1.34];
y2 = [207.20 210.40 188.80];
z2 = [183.60 201.90 184.60];
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
x3 = [0.65 0.92 1.33];
y3 = [258.10 211.90 192.20];
z3 = [138.20 152.60 197.30];
x4 = [0.65 0.76 0.74];
y4 = [394.73 146.90 428.90];
z4 = [196.30 236.60 273.70];
x5 = [0.59 0.98 1.25];
y5 = [327.90 309.10 363.00];
z5 = [156.40 221.70 317.30];
x6 = [0.54 0.60 0.79];
y6 = [308.80 244.20 245.70];
z6 = [133.60 109.70 156.10];
X = [x1 x2 x3 x4 x5 x6];
Y = [y1 y2 y3 y4 y5 y6];
Z = [z1 z2 z3 z4 z5 z6];
scatter(X,Y,[],Z,'filled')
xlabel('e')
ylabel('S')
zlabel('Wf')
grid on
colorbar
If you need to be able to visually connect the groups together, plot each group as its own series and then add a scatter on top, where the marker color indicates the Z value.
X = [x1' x2' x3' x4' x5' x6'];
Y = [y1' y2' y3' y4' y5' y6'];
Z = [z1' z2' z3' z4' z5' z6'];
figure
plot(X,Y,'--')
hold on
scatter(X(:),Y(:),[],Z(:),'filled')
hold off
grid on
colorbar
xlabel('e')
ylabel('S')
zlabel('Wf')
legend("Group"+[1:6],'Location','NorthOutside','NumColumns',3)
Mariia Arseenko
Mariia Arseenko 2022년 1월 28일
That perfectly worked, thanks a lot!
Star Strider
Star Strider 2022년 1월 28일
@Mariia Arseenko — Accepting Cris’s Answer is the best way to express your thanks.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2022년 1월 28일

댓글:

2022년 1월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by