フィルターのクリア

How do I make colors for scatter3 same as in Stata graphs

4 ビュー (過去 30 日間)
B de Bruin
B de Bruin 2020 年 8 月 17 日
回答済み: Aditya Patil 2020 年 11 月 20 日
I have data that I visually represent using Stata and using MatLab. I have seven colors in the Stata graph, corresponding with seven groups. I would like to use the same colors in the MatLab graph I create with scatter3d. How?

回答 (1 件)

Aditya Patil
Aditya Patil 2020 年 11 月 20 日
You can pass a 3D matrix of RGB values to scatter3 function as in following example,
[X,Y,Z] = sphere(16);
x = [0.5*X(:); 0.75*X(:); X(:)];
y = [0.5*Y(:); 0.75*Y(:); Y(:)];
z = [0.5*Z(:); 0.75*Z(:); Z(:)];
S = repmat([50,25,10],numel(X),1);
C = repmat([1,2,3],numel(X),1);
s = S(:);
c = C(:);
figure
scatter3(x,y,z,s,c)
view(40,35)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by