plotboxpos
This function returns the position of the plotted region of an axis, which may differ from the actual axis position, depending on the axis limits, data aspect ratio, and plot box aspect ratio. The position is returned in the same units as the those used to define the axis itself. This function can only be used for a 2D plot.
Example:
f1 = figure('Position', [50 50 300 300]);
a1 = axes('Position', [.25 .25 .5 .5], ...
'DataAspectRatio', [10 1 1], ...
'XLim', [0 100], ...
'YLim', [0 20]);
pos = plotboxpos(gca);
f2 = figure('Position', [50 50 300 300]);
a2 = axes('Position', pos);