I have some heavy calculations with generates huge list of {x, y}
points. I want to dynamically update plot during calculations. Or update it after calculations complete. I can't use simple Dynamic @ Plot
, because it makes calculation time 5-10x times longer. So I made some example, how I tried to solve this problem. But it didn't work.
Manipulate[None,
Grid[
{{Dynamic[
ListPlot[
Refresh[pts, UpdateInterval -> 5],
PlotRange -> All],
UpdateInterval -> 2],
SpanFromLeft,
SpanFromLeft},
{Slider[Dynamic[a], {10, 20, 1}],
Dynamic@ProgressIndicator[i, {1, a}],
Button["Run", func[], Method -> "Queued"]}}],
TrackedSymbols :> {},
ContinuousAction -> False,
SynchronousUpdating -> False, LocalizeVariables -> True,
Initialization :> (
pts = {{0, 0}}; a = 10; i = 1;
func[] :=
Module[{},
For[i = 1;, i < a, i++, Pause[.5]; AppendTo[pts, {i, i}]]])]
So how can I refresh plot only every n seconds? Or refresh after all calculations complete?
ListPlot[]
has to do a lot of fancy stuff. If you just need a graphical monitor, go raw:Graphics[Point[pts], Axes -> True]
. $\endgroup$