I am wondering if you have good ways to show plots inside a loop in mma. Usually, the output of Plot function is not shown, for example in the following code:
For[i = 1, i <= 10, i++, Plot[Sin[i*x], {x, -Pi, Pi}]]
Thanks for your help.
Edit
In connection to my previous question, I already have the For loop, for example, like this For[i = 1, i <= 10, i++, Plot[Sin[i*x], {x, -Pi, Pi}]]. Given this fact, I want to have something like “press any key to continue…” inside the For loop, then refresh the plot every time I press any random key. Could anybody give a complete working code?
Just use
Print:or
Monitor:(Pause is used here to give some time to view the plot; the loop is pretty fast here. Remove if necessary)
EDIT
On request a version that is controlled by mouse clicks on the graph (key presses need the graph to have focus so you need to click anyway)
This is a pretty stupid way to do this. The loop redraws the plot continuously. So, a slightly (but still ugly) version might be: