2
$\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$

1 Answer 1

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$
1
  • $\begingroup$ Hah, that's interesting! I would have never thought of this, thanks! $\endgroup$
    – Pirx
    Sep 20, 2016 at 15:10

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.