% parallel coordinate 3D line % with evenly spaced parametric points clf clear all npoints=30; %define the line parameter t=linspace(0,1,npoints) %use the parameter to define a line position(1,:)= t; %x position(2,:)= 1-.5*t ; %y position(3,:)= 0.5-.1*t ; %define a color map s=t; map=jet(10) ; s = 10*(s - min(s))/(max(s)-min(s))+1 ; %====================================== % The parallel plot subplot(2,1,1) hold on for i = 1:npoints cindex = min( fix(s(i)), 10); plot(position(:,i), 'color', map(cindex,:) ); end %draw the parallel axis axisx = [1,3; 1,1; 2,2; 3,3; ]'; axisy = [0,0; 0,1; 0,1; 0,1; ]'; line(axisx, axisy, 'color', 'k'); set(gca, 'xticklabel', {'x1', ' ', 'x2',' ','x3'}) %====================================== % The line regular 3D subplot(2,1,2) Title('Line: x1=t; x2=1-.5*t; x3=0.5-.1*t;') set(gca,'color','white') box on view(22,63) axis vis3d xlabel('x1');ylabel('x2');zlabel('x3'); hold on for i = 1:npoints cindex = min( fix(s(i)), 10); plot3(position(1,i),position(2,i),position(3,i),... 'markerfacecolor', map(cindex,:),... 'markersize',2 ,'color',map(cindex,:),... 'marker','o',... 'linewidth',2) end rotate3d on