Reputation: 4373
I'm plotting a 2D scatter plot in Matlab and I would like to have the ylim and xlim have the same lower and upper bound. Is there a command to do this automatically without that I would have to manually check which axis has bigger maximum value and which one the lower minimum value in order to set the limits manually using xlim
and ylim
?
Thnx for any help =)
Upvotes: 0
Views: 3272
Reputation: 114866
try
>> axis equal
to set the aspect ratio of x-y to be the same
For a manual setting
>> v = axis; % get current values
>> lo = min( v(1:2:end) ); % lower limit
>> up = max( v(2:2:end) ); % uppper limit
>> axis( [lo up lo up] );
Upvotes: 3