# matlab set center of output figure to [0 0 0]

I have a few set of data of three dimensional matrices, n x 3 with x, y and z coordinates. I viewed the matrices in the figure window.

% read function;
FV.vertices=OBJ1.vertices;
FV.faces=OBJ1.objects(2).data.vertices;
figure, patch(FV,'facecolor',[0 0 1]); camlight
grid on
axis equal


I want to read other sets of data by using the same function, but sets the center of each figure (not the center of origin) at [x y z]=[0 0 0].

Note that when I use the function above, the center of outputs is not always at [0 0 0].

Is it can be done by using translation function?

If you want a perfectly square set of axes with the center at $(0,0,0)$, while keeping all of the data on screen, I'd do something like this:
axis auto;

If you like your axes limits to be integral, change max(abs(a)) to ceil(max(abs(a))).
• Well, you've gotta do what looks right. But the purpose of axis auto is to get the extends of the 3-D figure. I use those to determine the smallest cube, centered at the origin, that contains the extents of the figure. – Michael Grant Apr 26 '13 at 3:27