4D scatterplot with one indicator value

1 view (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 23 Jul 2011
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 Comments
Tom
Tom on 23 Jul 2011
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 on 23 Jul 2011
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]);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!