I determined to make your code work but I'm stuck! I'm a novice MATLAB user so my problem may be simple. I downloaded and saved your file to the same folder where my other m.files are. I created a Figure (a simple x, y plot) and entered 'dragzoom'. The following is what happened.
Very nice submission! Is there an easy way to add the ability to make the magnifier sticky (i.e. it doesn't disappear when you let go of the "m" key)? And the follow-on question would be could you then have a second magnifier box with the next "m" press? I'm thinking something along the lines of shift+m to make a new sticky magnifier and then ctrl+m to delete all magnifiers (or something like that).
I really like this submission not just for all the handy interactivity it provides, but also for the great handling of the windowfcn callbacks. Seeing how you handled that was worth the download. I did notice one small bug. When you call dragzoom on an axes that is actually a child of a panel using the scroll button doesn't work. Other than that, great submission.
Thanks Evgeny, this is a really useful tool. Although I downloaded it a while ago I have only recently started to use it regularly.
It feels like a more intuitive way interacting with a plot, dragging and zooming like in Google Maps. This is much more natural (and quicker) for me than clicking the pan and zoom tools. I think this facility should be built into MATLAB graphics (which are badly in need of a revamp).