Allows direct zooming and panning with the mouse in 2D plots.
Scroll wheel: zoom in/out
Left Mouse Button: select an ROI to zoom in
Middle Mouse Button: pan view
Right Click: reset view to default view
SYNTAX:
akZoom
akZoom(h_ax)
DESCRIPTION:
akZoom activates mouse control for all axes-objects in the current figure.
akZoom(h_ax) activates mouse control for all axes given by the handle
array h_ax. The axes can be subplots or even in different figures and are
automatically linked. This means that when zooming or panning one axis
all others will be affected to.
EXAMPLES:
a) Simple Plot
x = linspace(-1, 1, 10000);
y = sin(1./x);
figure
plot(x, y);
akZoom();
b) Plotyy (linked axes)
x = linspace(-1, 1, 10000);
y = sin(1./x);
y2 = -2*sin(1./(x-0.1));
figure
ax = plotyy(x,y,x,y2);
akZoom(ax);
c) Plotyy (independent axes)
x = linspace(-1, 1, 10000);
y = sin(1./x);
y2 = -2*sin(1./(x-0.1));
figure
ax = plotyy(x,y,x,y2);
akZoom();
d) Image
figure
imagesc(magic(40));
akZoom();
e) Subplots (independent axes)
figure
for k = 1:4
y = rand(1,15);
subplot(2, 2, k);
plot(y);
end
akZoom();
e) Subplots (linked axes)
figure
ax = NaN(4,1);
for k = 1:4
y = rand(1,15);
ax(k) = subplot(2, 2, k);
plot(y);
end
akZoom(ax);
f) Different figures (linked)
x = linspace(-1, 1, 10000);
y = sin(1./x);
figure
plot(x, y)
ax(1) = gca;
figure
plot(x, y)
ax(2) = gca;
akZoom(ax);
KNOWN BUGS
a) Strange double tick marks appear while you draw the ROI-rectangle in figures with an image in it.
This happens in old Matlab-Versions and is a bug of the Matlab OpenGl-Renderer
You can avoid this by switching to software rendering: opengl software
Author: Alexander Kessel
Affiliation: Max-Planck-Institut für Quantenoptik, Garching, Munich
Contact : alexander.kessel <at> mpq.mpg.de
Revision: April 2013
Credits go to Rody P.S. Oldenhuis for his mouse_figure function which
served as the template for akZoom and to Kang Zhao for the gpos function. |