i have following code:
limits = [-1 1 -1 1]; g1 = [1;2;3;4;5;6;7;8]; col = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 0 0 0; 0.5 0.3 0.1]; sym = 'vvvv^^^^'; sym2 = 'xxxxxxxx'; points = 30; = 1:8; mhur(i,1) = mean(hsrxdistpr(i,:)); mhur(i,2) = mean(hsrydistpr(i,:)); mhul(i,1) = mean(hsrxdistpl(i,:)); mhul(i,2) = mean(hsrydistpl(i,:)); mhux(i,1) = mean(totxcomhsrpx(i,:)); mhux(i,2) = mean(totxcomhsrpy(i,:)); cr{i} = cov(hsrxdistpr(i,:),hsrydistpr(i,:)); cl{i} = cov(hsrxdistpl(i,:),hsrydistpl(i,:)); cx{i} = cov(tocomxdistp(i,:),tocomydistp(i,:)); ellipr{i} = uncertellip(cr{i},mhur(i,:),points); ellipl{i} = uncertellip(cl{i},mhul(i,:),points); ellipx{i} = uncertellip(cx{i},mhux(i,:),points); end figure; hold on scatter(hsrxdistbr2,hsrydistbr2,'ko'); hold on scatter(hsrxdistbl2,hsrydistbl2,'ko'); hold on scatter(tocomxdistb2,tocomydistb2,'kx'); hold on gscatter(hsrxp2(:,1),hsryp2(:,1),g1,col,sym), hold on gscatter(hsrxp2(:,2),hsryp2(:,2),g1,col,sym), hold on gscatter(cophsrxp2(:,2),cophsryp2(:,2),g1,col,sym2), hold on = 1:8; plot(ellipr{i}(:,1),ellipr{i}(:,2),col(i,:)), hold on plot(ellipl{i}(:,1),ellipl{i}(:,2),col(i,:)), hold on plot(ellipx{i}(:,1),ellipx{i}(:,2),col(i,:)), hold on end vline(0) hline(0) legend('base','base','base','-0.04m', '-0.08m', '-0.12m', '-0.16m', '0.04m', '0.08m', '0.12m', '0.16m'); title({'xcom , left , right foot placement relative',... 'to xcom per perturbation, subjects'}) axis(limits) xlabel('x displacement (scaled)'); ylabel('y displacement (scaled)');` i'm trying line plots (second for loop) have same colors scatter plot data (the uncertainty ellipses each belong own scatter point). however, won't allow me use colors col matrix. missing here?
error:
data must single matrix y or list of pairs x,y.
not trying define colors works fine, of course colors don't match.
try replacing each of erroring lines this:
plot(ellipr{i}(:,1),ellipr{i}(:,2),'color',col(i,:));
Comments
Post a Comment