File Exchange

image thumbnail

Zoom mode (h-axis, y-axis or both axis) set by mouse position

version 1.3.0.0 (1.85 KB) by Thibaut Jacqmin
Switch between vertical/horizontal/both axis zoom mode by moving the mouse above the figure.

5 Downloads

Updated 03 May 2017

View License

In a matlab figure, in order to switch between vertical axis zooming and horizontal axis zooming, the user must click on Tools/Option/..., or right-click on the figure and to chose the zoom mode, which can be painful if one needs to switch between zooming modes very often. This function solves this issue by changing the zooming mode depending on the mouse position. If the mouse is over the vertical/horizontal axis the vertical/horizontal axis zoom is activated. If the mouse is in the center of the plot, both axis are activated.
The function takes a figure as input arguments. This figure must have axes already before calling the function. Also, the Units property of both the figure and its axes should be the same.
Example of use:

f = figure;
a = axes(f);
a.Units = f.Units;
auto_zoom(f);

Then click on the zoom icon, and move the mouse over the vertical/horizontal axis, and
over the center of the plot. You will see the zooming mode change automatically. Zoom with the mouse wheel.

Comments and Ratings (1)

max max

Updates

1.3.0.0

Improve description

1.3.0.0

Improving perfomance

1.2.0.0

Change Title

1.1.0.0

Refine mouse position condition.

1.0.0.0

Description improvement

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux