I would like to be able to plot a box in a 2-D graph that perfectly reproduces the box framing of a 3-D current axis. For example, I can use the VIEWMTX function:
set(gca,'units','normalized')xc=get(gca,'cameratarget')hold onx = [0 1 1 0 0 0 1 1 0 0 1 1 1 1 0 0];y = [0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1];z = [0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0];[th,ph]=view;A = viewmtx(th,ph,0,xc);[m,n] = size(x);x4d = [x(:),y(:),z(:),ones(m*n,1)]';x2d = A*x4d;x2 = zeros(m,n); y2 = zeros(m,n);x2(:) = x2d(1,:);y2(:) = x2d(2,:);plot(x2,y2)
However, it does not perfectly reproduce the box. It seems to be off center.
Best Answer