Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is the method I used to plot biplot data with different colors. The lines of code prior to plot are taken from the biplot.m file. The way biplot manipulates data is kept intact and stops skewing of data when using overlaid biplots.</p> <p>This coding is not the most efficient, one can see parts that can be cut. I wanted to keep the code intact so one can see how biplot works in it's entirety. </p> <pre><code>%%%%%%%%%%%%%%%%%%%%% xxx = coeff(:,1:3); yyy= score(:,1:3); **%Taken from biplot.m; This is alter the data the same way biplot alters data - having the %data fit on grid axes no larger than 1.** [n,d2] = size(yyy); [p,d] = size(xxx); %7 by 3 [dum,maxind] = max(abs(xxx),[],1); colsign = sign(xxx(maxind + (0:p:(d-1)*p))); xxx = xxx .* repmat(colsign, p, 1); yyy= (yyy ./ max(abs(yyy(:)))) .* repmat(colsign, 42, 1); nans = NaN(n,1); ptx = [yyy(:,1) nans]'; pty = [yyy(:,2) nans]'; ptz = [yyy(:,3) nans]'; **%I grouped the pt matrices for my benefit** plotdataholder(:,1) = ptx(1,:); plotdataholder(:,2) = pty(1,:); plotdataholder(:,3) = ptz(1,:); **%my original score matrix is 42x3 - wanted each 14x3 to be a different color** scatter3(plotdataholder(1:14,1),plotdataholder(1:14,2),plotdataholder(1:14,3),35,[1 0 0],'marker', '.'); hold on; scatter3(plotdataholder(15:28,1),plotdataholder(15:28,2),plotdataholder(15:28,3),35,[0 0 1],'marker', '.') ; scatter3(plotdataholder(29:42,1),plotdataholder(29:42,2),plotdataholder(29:42,3),35,[0 1 0],'marker', '.'); xlabel('Principal Component 1'); ylabel('Principal Component 2'); zlabel('Principal Component 3'); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload