Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically invoke zoom event in MatLab?

I am using "plot_google_map.m" that uses the Google Maps API to plot a map in the background of the current figure. A figure generated with this auto-refreshes the map upon zooming event, and I added some codes to make it refresh data upon panning event, too.

Now I would like to programmatically change the range of axes without using zoom or pan buttons, but the problem is map is not refreshed automatically. So, I am thinking of generating zooming or panning event programatically, but I haven't found a way to do that. Any idea on this?

Let me elaborate my question. In the 'plot_google_map.m', there is subfunction which is a callback of zooming event.

function plot_google_map  
% Listen to Zoom events    
h  = figure(1); plot(1:10);
hz = zoom(h);
set(hz,'ActionPostCallback',@mypostcallback);

function mypostcallback(obj,evd)
disp('Refreshes map data');

What I want to do is, to call this subfunction outside the 'plot_google_map'.
Any idea is welcomed, and thank you for your answers in advance!

like image 527
Seungwoo Noh Avatar asked Oct 22 '22 19:10

Seungwoo Noh


1 Answers

You heard about the zoom command?

>> help zoom
 zoom   Zoom in and out on a 2-D plot.

Actually it seems that's how the program recognizes you zooming.

like image 51
bdecaf Avatar answered Oct 25 '22 18:10

bdecaf