1
$\begingroup$

Say I have two data sets, data1 and data2

data1 = Range[1, 20, 1];
u = 0;
o = 6;
data2 = Table[Exp[-(x - u)^2/(2 o^2)], {x, 0, 20, 1}];

And they look something like

ListPlot[data1, Joined -> True]
ListPlot[data2, Joined -> True, PlotRange -> All]

enter image description here

Is there any way I could animate a transition from data1 to data2, i.e. I'd like to see the data move into the new graph...like what can be seen here

enter image description here

$\endgroup$
1
  • $\begingroup$ Can you give us a transition function? $\endgroup$ Oct 24, 2018 at 22:38

1 Answer 1

5
$\begingroup$
data1 = Range[0, 20, 1]/20;
u = 0;
o = 6;
data2 = Table[Exp[-(x - u)^2/(2 o^2)], {x, 0, 20, 1}];
data3[t_] :=  t data1 + (1 - t) data2;
Manipulate[ListPlot[data3[t], Joined -> True,
  PlotRange -> {0, 1}], {t, 0, 1, .01}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.