Making looping plots interactive with zoom and pan

5 views (last 30 days)
I have a set of data (2D space, 1D time), which I normally make movies out of.
I'd like to create a GUI in Matlab in which I can loop over the data in time, like a movie, but allow the user to interactively use the plotting tools (zoom, pan specifically) while the loop is still going. Perhaps also have a "pause" and "rewind/forward" slider bar.
It seems like someone would have already done this, but I'm not finding that functionality on the FEX.
If not, it seems like I can do this with capturing zoom and pan events, and a while loop doing the plotting. Does this seem feasible?

Answers (1)

Chad Greene
Chad Greene on 20 Nov 2014
Edited: Chad Greene on 20 Nov 2014
Check out how Carlos Adrian Vargas Aguilera does it with ginput2.
There's a lot to decipher there, so perhaps you could do something like
if waitforbuttonpress % waitforbuttonpress is 1 if user hits any keyboard key
char = get(gcf, 'CurrentCharacter'); % char is the character number of pressed key
if char == 122 % 122 is the character number of lowercase z
lim = axis; % get current axis limits
pti=get(axes_handle, 'CurrentPoint'); % get current cursor point
% center axis limits on cursor point:
axis([pti(1,1)+diff(lim(1:2))/2*[-1 1] pti(1,2)+diff(lim(3:4))/2*[-1 1]]);
zoom(2) % zoom in
end
end

Categories

Find more on Visual Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!