matlab - 3d plot with axes of same length -
i have 3d trajectories want plot. since vary lot in xy, less in z, default plot3 misleading, because automatically scales axes.
i've been told use axes equal
has no effect (see commented line used it).
i came code, in opinion long achieve simple task:
[d,rate]=read_vicon_ascii('csvdata/a1-0.csv'); % or replace above line d=csvread('stackoverflow-31289872.csv'); % stackoverflow-31289872.csv @ https://drive.google.com/file/d/0b5gjkidzk3f5uhlvquxkefo4sg8/view?pli=1 % indices of x,y,z columns x = 1+(2:3:14); y = 2+(2:3:14); z = 3+(2:3:14); bounds = [ min(min(d(:,x))) max(max(d(:,x))) min(min(d(:,y))) max(max(d(:,y))) min(min(d(:,z))) max(max(d(:,z))) ]; maxdelta = max(bounds(:,2)-bounds(:,1)); squarebounds = bounds; xyz=1:3 delta = squarebounds(xyz,2) - squarebounds(xyz,1); squarebounds(xyz,:) = squarebounds(xyz,:) + (maxdelta - delta) * [-0.5 0.5]; end figure hold on i=1:5 plot3(d(:,x(i)),d(:,y(i)),d(:,z(i)),'r-') end xlim(squarebounds(1,:)) ylim(squarebounds(2,:)) zlim(squarebounds(3,:)) %axes equal hold off
is there way make better. (or correct usage of axes equal
if supoosed do?)
Comments
Post a Comment