DRAGZOOM - Drag and zoom tool

版本 1.13.0.0 (18.9 KB) 作者: Evgeny Pr
DRAGZOOM allows you to handy interactively manage the axes in figure.
5.8K 次下载
更新时间 2011/6/5

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

DRAGZOOM allows you to interactively manage the axes in figure. This simple function for usable dragging and zooming of axes, rotate 3D axes, using the mouse and the keyboard shortcuts.

Features:
- Supports 2D-Plots, 3D-plots, Log plots and Images
- Supports multiple mixed (subplots) (2D, 3D) axes on one figure
- Supports X,Y,XY linking of several 2-D axes (Synchronize manage)
- Rubber Band Region Zooming
- Magnifier Tool
- Handy Cross-hair Cursor
- Handy Zooming and Draging Plots
- Handy and Fast Rotate 3D Plots
- Control Enabled Status

----------------------------------------------
Using:
dragzoom()
dragzoom(hFig)
dragzoom(hAx)
dragzoom(hAxes) % array of axes handles
dragzoom(hFig, status) % status - set enable status 'on' or 'off'
dragzoom(status)

----------------------------------------------
Control Enabled Status of DRAGZOOM:
dragzoom(hFig, 'on') % Enable DRAGZOOM for figure "hFig"
dragzoom(hFig, 'off') % Disable DRAGZOOM for figure "hFig"
dragzoom('on') % Enable DRAGZOOM for figure "GCF"
dragzoom('off') % Disable DRAGZOOM for figure "GCF"

----------------------------------------------
Interactive mode:
Available the following actions:

******************************
2D and Image modes:
******************************
- Mouse actions in 2D mode:
-- Normal mode:
"single-click and holding LB" - Activation Drag mode
"single-click and holding RB" - Activation Rubber Band for region zooming
"single-click MB" - Activation 'Extend' Zoom mode
"scroll wheel MB" - Activation Zoom mode
"double-click LB, RB, MB" - Reset to Original View

-- Magnifier mode:
"single-click LB" - Not Used
"single-click RB" - Not Used
"single-click MB" - Reset Magnifier to Original View
"scroll wheel MB" - Change Magnifier Zoom
"double-click LB" - Increase Magnifier Size
"double-click RB" - Decrease Magnifier Size

- Hotkeys in 2D mode:
'+' - Zoom plus
'-' - Zoom minus
'0' - Set default axes (reset to original view)
'uparrow' - Up or down (inrerse) drag
'downarrow' - Down or up (inverse) drag
'leftarrow' - Left or right (inverse) drag
'rightarrow' - Right or left (inverse) drag
'c' - On/Off Pointer Symbol 'fullcrosshair'
'g' - On/Off axes grid (only plots)
's' - On/Off smoothing plots
'x' - If pressed and holding, zoom and drag works only for X axis
'y' - If pressed and holding, zoom and drag works only for Y axis
'm' - If pressed and holding, Magnifier mode on
'l' - On XY / Off X,Y,XY linking 2-D axes (Synchronize manage)
'control+l' - On X linking 2-D axes
'alt+l' - On Y linking 2-D axes

******************************
* 3D Mode:
******************************
- Mouse actions in 3D mode:
"single-click and holding LB" - Activation Drag mode
"single-click and holding MB" - Activation 'Extend' Zoom mode
"single-click and holding RB" - Activation Rotate mode
"scroll whell MB" - Activation Zoom mode
"double-click LB, RB, MB" - Reset to Original View

- Hotkeys in 3D mode:
'+' - Zoom plus
'-' - Zoom minus
'0' - Set default axes (reset to original view)
'uparrow' - Rotate up-down
'downarrow' - Rotate down-up
'leftarrow' - Rotate left-right
'rightarrow' - Rotate right-left
'ctrl'+'uparrow' - Up or down (inrerse) drag
'ctrl'+'downarrow' - Down or up (inverse) drag
'ctrl'+'leftarrow' - Left or right (inverse) drag
'ctrl'+'rightarrow' - Right or left (inverse) drag
'1' - Go to X-Y view
'2' - Go to X-Z view
'3' - Go to Y-Z view
'v' - On/Off Visible Axes
'f' - On/Off Fixed Aspect Ratio
'g' - On/Off Visible Grid

----------------------------------------------
Examples:

% 2D
x = -pi:0.1:pi;
y = sin(x);
figure; plot(x, y);
dragzoom

% Image
I = imread('cameraman.tif');
figure; imshow(I, []);
dragzoom

% 3D
figure;
[X,Y] = meshgrid(-3:.125:3);
Z = peaks(X,Y);
meshc(X,Y,Z);
axis([-3 3 -3 3 -10 10]);
xlabel('x');
ylabel('y');
zlabel('z');
dragzoom;

figure;
x = -pi*2:0.1:pi*2;
y1 = sin(x);
y2 = cos(x);
hax1 = subplot(2,1,1); plot(x,y1, '.-r')
hax2 = subplot(2,1,2); plot(x, y2, 'o-b')
dragzoom(hax1); % manage only axes 1

引用格式

Evgeny Pr (2024). DRAGZOOM - Drag and zoom tool (https://www.mathworks.com/matlabcentral/fileexchange/29276-dragzoom-drag-and-zoom-tool), MATLAB Central File Exchange. 检索时间: .

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

Community Treasure Hunt

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

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

- add separate X, Y and XY linking 2-D axes

1.12.0.0

-fixed bug of magnifier
-fixed bug of legend capture and delete
-added more flexible format numbers of cross-hair cursor

1.11.0.0

- added linking 2-D axes (Synchronize manage)
- added info to figure title
- fixed bug of rubber band
- fixed bug draging rectangular images
- fixed and improved of magnifier tool (now always square size and independent from axes size)

1.10.0.0

- added control enable status of DRAGZOOM
- fixed bugs in cross pointer
- fixed bugs of set initial axes positions

1.9.0.0

- fixed problem with images (in last update was confused drag on the Y-axis)

1.8.0.0

- added support semilogx, semilogy, loglog plots

1.7.0.0

- fixed error using incorrect handle in saved figures.
- added option "smooth lines" for 2D plots

1.6.0.0

- Fixed a bug with the work on the saved figure

1.1.0.0

- Fixed bug with the specified axis (call: dragzoom(hAxes))
- If the mouse is outside of the axes, some interactive mouse actions are disabled

1.0.0.0