0
$\begingroup$

I am quite new to coding world... I am struggling with combining ListLinePlot with Animation, so that it is visible how circle is moving on the path. Here is my code

L1 = ListLinePlot[Koordi[[1, 1]]]
p = Animate[
Graphics[{Circle[{x, Koordi[[1, 1, x]]}, 0.5]}, 
PlotRange -> {{0, 100}, {80, 115}}], {x, 0, 110}, 
AnimationRunning -> False];
Show[L1, p]

Where as the Koordi are some coordinate points. Like this:

{93.3809, 93.6573, 93.934, 94.2112, 94.4893, 94.7684, 95.0488,
95.3308, 95.6148, 95.9008, 96.1892, 96.4803, 96.7744, 97.0715,
97.3718, 97.6755, 97.9827, 98.2935, 98.608, 98.9264, 99.2489,
99.5756, 99.9066, 100.242, 100.582, 100.927, 101.276, 101.631,
101.991, 102.356, 102.726, 103.102, 103.484, 103.872, 104.265, 104.665}

Mathematica output

Thanks in advance for your help!

$\endgroup$
  • $\begingroup$ Without a full definition of Koordi, this is going to be difficult to debug completely, but some points: 1. You cannot combine the plot L1 and the animation p with Show. You're going to have to wrap animate on the outside of Show rather than inside. 2: In Koordi[[1, 1, x]], x should be an integer running between 1 and the length of the list Koordi[[1, 1]]. Your animation makes x a float running from 0, so this can never work. $\endgroup$ – Sjoerd Smit Apr 4 '18 at 16:00
  • $\begingroup$ Thank you for your comment, I wrapped the animation on the outside of Show and fixed the interval for x. Now it is working. $\endgroup$ – Matkov Apr 4 '18 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.