MATLAB Answers

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

6 views (last 30 days)
rockthekasbah
rockthekasbah on 8 Nov 2018
Commented: KSSV on 8 Nov 2018
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)

KSSV
KSSV on 8 Nov 2018
[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

Community Treasure Hunt

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

Start Hunting!