MATLAB: Rescaling axes when new point is plotted near current axis limits

axis limitsrescalerescalingscaling

Hi, right now I have a bunch of points plotted. When I plot a new point that is close to the current axis limits but not outside of them, I need the axes to rescale so that the new point is not too close to the edge. How can I achieve this?
Thanks

Best Answer

There is no MATLAB command to get that to happen automatically.
The easiest way by far would be for you to create a routine that checked the items of interest to you and did the resizing, and call that routine after you have added what you want to add.
It would probably be possible to create listeners on every child object of an axes that has a position or which can have new children added or which can have its data altered to represent new positions, and have the listener go through the axes and re-determine whether the axes needs to be resized, but I think that would be very much a waste of effort.