How to make an interactive plot that would show timeseries data on a spatial map?

I would like to make an interactive plot in such a way that it has the desired spatial points on a lat-long plot and upon clicking a point on the lat-long space using the mouse it would show the timeseries data of a variable at that particular point. I can, of course, plot the spatial points and the timeseries but I am having trouble finding ways to connect the two plots into one.
P.S. - I realize a simple animation would be an easier way but I do not want to do that.

Answers (1)

[X,Y,Z] = peaks(100) ;
h1 = figure(1) ;
subplot(211)
pcolor(X,Y,Z) ;
shading interp
while true
[x,y] = getpts(h1) ;
% Do interpolation/ selection get the time series for x,y
subplot(212)
plot(rand(100,1)) ;
title(sprintf('x = %f,y=%f',x,y))
end

2 Comments

Great answer man! But getpts only works if you have the Image Processing toolbox which I don't :(
Do you any alternatives?

Sign in to comment.

Categories

Asked:

on 8 Nov 2018

Commented:

on 8 Nov 2018

Community Treasure Hunt

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

Start Hunting!