Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to plot the points (i,j,k) as they are generated in the loop but in the same plot. The next draws the points in different windows.

list = {};
Do[list = Append[list, {i, j, k}]; 
 Print[ListPointPlot3D[list]], {i, 3}, {j, 3}, {k, 3}]

Is there any function in Mathematica that allows us to draw plots dynamically, i.e., keeping the plots that were already generated as new ones are being generated from a loop (all in the same window)?

share|improve this question
Why not just generate the points all at once, use Take[] on the list of points, and then plot that particular subset? – J. M. Nov 18 '12 at 6:08

There are many ways to do this. Here is one way which keeps your procedural code setup of using a loop. Make a plot variable p as Dynamic. So the frontend will update p automatically each time it is changed inside the loop.

list = {};
p = {};

 list = Append[list, {i, j, k}];
 p = ListPointPlot3D[list],
 {i, 10}, {j, 10}, {k, 5}

enter image description here

share|improve this answer

Here is a different approach using ListAnimate and Part to create a point by point animation of an arbitrary set of points, and which can be viewed at various frame rates and keeps a constant range of plot as more points are added.

Define some points and extract the range of the points:

points = Tuples[Range@4, 3];
range = {1, Max@#} & /@ Transpose@points;

Animate the plotting of the points:

ListAnimate[ListPointPlot3D[points[[1;;#]], PlotRange->range]& /@ Range@Length@points]


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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