3D plot represented in 2D
Show older comments
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
Answers (1)
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 Comments
Mariia Arseenko
on 28 Jan 2022
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
on 28 Jan 2022
Star Strider
on 28 Jan 2022
@Mariia Arseenko — Accepting Cris’s Answer is the best way to express your thanks.
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


