1
$\begingroup$

Is it possible to have a labeled slider in ListAnimate? Example: Let's say I have

ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 5}]]

but I'd like the slider to show the name of the iterator (n in this case), and its current value, the way this could be done in Manipulate with a command like

Manipulate[Plot[Sin[n x], {x, 0, 10}], {{n, 1, n}, 1, 5, 1, Appearance -> "Labeled"}]

Alternatively, perhaps even better, I could not show a slider at all, and instead add a text label (or some fancy graphic) showing the information I want as a graphics object (probably using Show). To be clear, I know how to add these elements to the graphic, but how do I get entirely rid of the slider?

$\endgroup$
2
$\begingroup$

One can replace the slider with a Clock:

DynamicModule[{n},
 Dynamic[n = Clock[{1, 5, 1}, 2];
  Plot[Sin[n x], {x, 0, 10}, PlotLabel -> n]
  ]
 ]

GIF

$\endgroup$
  • $\begingroup$ Hah, that's interesting! I would have never thought of this, thanks! $\endgroup$ – Pirx Sep 20 '16 at 15:10

Your Answer

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

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