Filter löschen
Filter löschen

How to plot scatter 3D with different marker?

8 Ansichten (letzte 30 Tage)
Putri Basenda Tarigan
Putri Basenda Tarigan am 5 Dez. 2020
Hello everyone.
If I have
X=randi(9,3,1)
Y=randi(9,3,1)
Z=randi(9,3,1)
How can I plot scatter 3D X,Y,Z with different marker?
For example I want
X(1),Y(1),Z(1) with marker 'x'
X(2),Y(2),Z(2) with marker '*'
X(3),Y(3),Z(3) with marker '^'
Thanks in advance

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Dez. 2020
Bearbeitet: Walter Roberson am 6 Dez. 2020
markers = {'x', '*', '^', '.', 'o', 's', 'd', '+', 'v', '>', '<', 'p', 'h', '_', '|'};
nmarkers = length(markers);
for K = 1 : length(X)
markidx = mod(K-1, nmarkers) + 1;
line(X(K), Y(K), Z(K), 'Marker', markers{markidx});
end
This cycles through the markers if need be.
Note: The '_' and '|' markers are new as of R2020b.
  3 Kommentare
Walter Roberson
Walter Roberson am 6 Dez. 2020
X=randi(9,3,1);
Y=randi(9,3,1);
Z=randi(9,3,1);
markers = {'x', '*', '^', '.', 'o', 's', 'd', '+', 'v', '>', '<', 'p', 'h', '_', '|'};
nmarkers = length(markers);
for K = 1 : length(X)
markidx = mod(K-1, nmarkers) + 1;
line(X(K), Y(K), Z(K), 'Marker', markers{markidx});
end
xlim([0 10]); ylim([0 10]); zlim([0 10]);
xlabel('x'); ylabel('y'); zlabel('z');
view(3)
Putri Basenda Tarigan
Putri Basenda Tarigan am 6 Dez. 2020
Thankyou so much Sir

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by