How do you color code scatter3 based off of a fourth variable?
I have a 128X5 matrix. I want the (:,3) (:,4) and (:,5) columns to be the x, y, and z coordinates of each point, respectively. However, I also want to color-code the points based off of the data pairs located in (:,1) and (:,2).
So, for example:
[0,1,x,y,z;2,0,x,y,z;0,-1,x,y,z;...0,1,x,y,z;2,0,x,y,z;0,-1,x,y,z]
And I would want any data with the (0,1) or (0,-1) pairs in the first two columns to show up red, (2,0) and (-2,0) to show up blue, and 2 other coordinate pairs to be graphed in black. The number appearing in column 1 is distinct, so I probably don't need to consider the coordinate pair, just the column 1 value.
How can I do this?
Currently, my code looks like this:
if v == dimension %Make a matrix to hold all of the RSD_c{} RSD_compiled=zeros(1,5); for t=1:v RSD_compiled=[RSD_compiled;RSD_c{1,t}]; end %Remove first line of zeros used to initialize matrix RSD_compiled=RSD_compiled(2:end,:)
% Data needs to be color-coordinated. figure('name', 'RSD vs. B vs. v'); scatter3( RSD_compiled(:,3), RSD_compiled(:,4), RSD_compiled(:,5) ); title(['Relationship Between Relative Standard Deviation, Bootstrap Replicates, and Dimension for radfrac =', num2str(radfrac), 'and TN =', num2str(u*50)]); xlabel('Bootstrap Replicates'); % x-axis label ylabel('Relative Standard Deviation'); % y-axis label zlabel('Dimensions'); % z-axis label end
0 Commenti
Risposta accettata
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!