Changing Axes Position and Aspect Ratio
We can modify the position and size of axes on a figure component by providing the Position parameter to the axes() function. Following is the syntax of the same.
axes_name = axes(‘Position’, [<vector defining the location and size of axes in figure component>])
The vector is a 1×4 row vector that has following syntax
[<position of left side> <position of bottom> <width of axes> <height of axes>]
All of these values can take values from 0 to 1 where 0 defines extreme left/bottom and 1 defines extreme right/top.
See the following example where we create the cartesian axes in center of figure
Example 6:
Matlab
% % MATLAB code f x = linspace(-3,3,10000); % Defining position in center ax=axes( 'Position' ,[.3 .3 .4 .4]); plot(ax,x,x.^0.324) |
Output:
Axes Appearance and Behavior in MATLAB
MATLAB offers many types of axes such as polar axes, cartesian axes, etc. The default appearances of these axes are dynamically determined by MATLAB on case-by-case requirements. However, MATLAB does provide its users the option to alter the behavior of these axes, by using some built-in functions. In this article, we shall how we can use these functions to alter the appearance of cartesian axes; the same methods could be applied to polar axes and other available axis types.