4D scatterplot with one indicator value

Hello,
I have four vectors: s1, s2, s3 as parameter vectors and vector i with indicator values of 0 or 1.
I would like to plot all s1-s2-s3 parameter combinations with value i = 1 with one color and all other s1-s2-s3 parameter combinations with value i = 0 with another color.
Thank you.

 採用された回答

Walter Roberson
Walter Roberson 2011 年 7 月 23 日

0 投票

pointsize = 8;
[s1g, s2g, s3g] = ndgrid(s1, s2, s3);
scatter3(s1g, s2g, s3g, pointsize, i);
colormap([1 0 0;0 1 0]);
However, before you do this, you will have to convert i from being a vector to being a matrix defined at each s1 x s2 x s3 possibility.

2 件のコメント

Tom
Tom 2011 年 7 月 23 日
Thanks, but I am not sure if I understand you correctly about coverting the vector to being a matrix. I did:
INEQ = [i DLparams1 DLparams2 DLparams3]
pointsize = 8;
[s1g, s2g, s3g] = ndgrid(DLparams1, DLparams1, DLparams1);
scatter3(s1g, s2g, s3g, pointsize, INEQ);
colormap([1 0 0;0 1 0]);
Error message.
Walter Roberson
Walter Roberson 2011 年 7 月 23 日
Now that I think of it, I was wrong about wanting to do the reshape.
If DLparams1 and DLparams2 and DLparams3 and "i" are vectors that are all the same length, then
pointsize = 8;
scatter3(DLparams1, DLparams2, DLparams3, pointsize, i);
colormap([1 0 0;0 1 0]);

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by