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

版本 1.3.0.0 (1.8 KB) 作者: Thibaut Jacqmin
Switch between vertical/horizontal/both axis zoom mode by moving the mouse above the figure.
94.0 次下载
更新时间 2017/5/3

查看许可证

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.

引用格式

Thibaut Jacqmin (2024). Zoom mode (h-axis, y-axis or both axis) set by mouse position (https://www.mathworks.com/matlabcentral/fileexchange/62723-zoom-mode-h-axis-y-axis-or-both-axis-set-by-mouse-position), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Visual Exploration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.3.0.0

Improving perfomance
Improve description

1.2.0.0

Change Title

1.1.0.0

Refine mouse position condition.

1.0.0.0

Description improvement