フィルターのクリア

How to plot scatter 3D with different marker?

8 ビュー (過去 30 日間)
Putri Basenda Tarigan
Putri Basenda Tarigan 2020 年 12 月 5 日
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

採用された回答

Walter Roberson
Walter Roberson 2020 年 12 月 6 日
編集済み: Walter Roberson 2020 年 12 月 6 日
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 件のコメント
Walter Roberson
Walter Roberson 2020 年 12 月 6 日
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 2020 年 12 月 6 日
Thankyou so much Sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by