Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matching axes scales

I have 3D data plotted using the 'plot3' function. I would like to constrain the Y and Z axes such that they are equal in scale. The X axis should be automatically scaled as usual.

I know from here that I can make the X axis be the only one to be automatically scaled by using the command:

axis 'auto x';

However, this causes the Y and Z axes to be plotted from 0 to 1 only; my data often exceeds this in all axes. What I'm looking for is a plot which contains all the data in a single view, but with the smallest of the Y or Z axes scaled down so that the Y and Z axes are equivalent in scale.

like image 672
CaptainProg Avatar asked Aug 10 '12 12:08

CaptainProg


2 Answers

Try daspect.

plot3(5*rand(10,1),10*rand(10,1),rand(10,1))

tmpAspect=daspect();
daspect(tmpAspect([1 2 2]))

daspect() returns the current aspect ratio as produced by axis 'auto'.

daspect(tmpAspect([1 2 2])) then enforces that y and z have the same scale.

like image 188
denahiro Avatar answered Oct 06 '22 08:10

denahiro


How about

axis equal

or even

axis tight
axis equal

both after the plot has been drawn.

Is this what you mean?

Type help axis at the Matlab command prompt for more capabilities of the axis function.

like image 36
Rody Oldenhuis Avatar answered Oct 06 '22 08:10

Rody Oldenhuis