Time Series Animation Plot

Hi all - I am trying to animate river discharge data over a year so x-axis is date and y-axis is volume. I have multiple lines on the graph representing different years. I would like to animate the figure by having the lines start Jan1 and plot line to the end. I adapted some code that works for one time series, but cannot get the others to graph. x = date ; y = riv(:,5) ; x2 = date ; y2 = riv(:,4); % Want this line to plot with x and y above N = NaN(size(x));
% Create the line and get its X and Y data h = plot(N, N);
xdata = get(h, 'XData'); ydata = get(h, 'YData');
axis([733020 733420 0 2000]) for k = 1:length(x) xdata(k) = x(k); ydata(k) = y(k); % Update the plot set(h, 'XData', xdata, 'YData', ydata); drawnow end
Any help with this would be great! I am pretty new to MATLAB. Thanks

Answers (0)

Categories

Asked:

on 3 Dec 2012

Community Treasure Hunt

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

Start Hunting!