In Matlab, I would like to update the data plotted in a set of axes when the user zooms into the plot window. For example, suppose I want to plot a particular function that is defined analytically. I would like to update the plot window with additional data when the user zooms into the traces, so that they can examine the function with arbitrary resolution.
Does Matlab provide hooks to update the data when the view changes? (Or simply when it is redrawn?)
Yes, it does. The ZOOM mode object has the following callbacks:
The latter two are executed either just before or just after the zoom function. You could set your update function in
ActionPostCallback, where you’d update the plot according to the new axes limits (the handle to the axes is passed as the second input argument to the callback).