Mercurial > repos > public > sbplib
diff scaleAxisLim.m @ 373:0976e579a6f0
Add functions for scaling figure windows and axes.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 25 Jan 2017 16:21:14 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scaleAxisLim.m Wed Jan 25 16:21:14 2017 +0100 @@ -0,0 +1,13 @@ +function scaleAxisLim(ah, s) + x = ah.XLim; + y = ah.YLim; + + xl = x(2) - x(1); + yl = y(2) - y(1); + + dx = xl*(s-1); + dy = yl*(s-1); + + ah.XLim = x + [-dx/2 dx/2]; + ah.YLim = y + [-dy/2 dy/2]; +end \ No newline at end of file