# plotting sequence of points

I am new to Mathematica, and I am trying to plot a sequence of 2D points so that the resulting video shows 1, then 2, then 3, ... points on the screen. Here is a simple minded version of what I am trying to do. It plots the first 3 points of the 20 points of an ellipse:

tab = Table[{4 Cos[t], 2 Sin[t]}, {t, 0, 2 \[Pi], 2 \[Pi]/20}];
pointTable = Table[Point[tab[[i]]], {i, 1, 20}];
Row[
Show[Graphics[pointTable[[1]], PlotRange -> {{-5, 5}, {-3, 3}},
Axes -> True, Ticks -> None]],
Show[Graphics[pointTable[[1 ;; 2]], PlotRange -> {{-5, 5}, {-3, 3}},
Axes -> True, Ticks -> None]],
Show[Graphics[pointTable[[1 ;; 3]], PlotRange -> {{-5, 5}, {-3, 3}},
Axes -> True, Ticks -> None]]
]


I haven't been able to use Do, or While or any other "loop" to generate an arbitrary number of points. I'll be most grateful for any help.

• Welcome to the Mathematica Stack Exchange. Please explore the ListAnimate function as well.
– Syed
Commented Jan 7, 2023 at 5:58
• Thank you Syed. Your suggestion was extremely useful. Commented Jan 8, 2023 at 19:18

I am trying to plot a sequence of 2D points so that the resulting video shows 1, then 2, then 3, ... points on the screen

ClearAll["Global*"]
tab = Table[{4 Cos[t], 2 Sin[t]}, {t, 0, 2 π, 2 π/20}];
plot[lis_List] :=
ListPlot[lis, PlotRange -> {{-4.5, 4.5}, {-4.5, 4.5}},
PlotStyle -> Red, GridLines -> Automatic,
GridLinesStyle -> LightGray];
Animate[plot[tab[[1 ;; n]]], {n, 1, Length[tab], 1}]


To display the point number also

tab = Table[{4 Cos[t], 2 Sin[t]}, {t, 0, 2 \[Pi], 2 \[Pi]/20}];
plot[lis_List, n_?NumericQ] := Grid[{{Row[{" point ", n}]},
{ListPlot[lis, PlotRange -> {{-4.5, 4.5}, {-4.5, 4.5}},
PlotStyle -> Red, GridLines -> Automatic,
GridLinesStyle -> LightGray, ImageSize -> 400]
}}];
Animate[plot[tab[[1 ;; n]], n], {n, 1, Length[tab], 1}]


Welcome to mathematica.stackexchange.com

tab = Table[{4 Cos[t], 2 Sin[t]}, {t, 0, 2 \[Pi], 2 \[Pi]/20}];
pointTable = Table[Point[tab[[i]]], {i, 1, 20}];
Show[Graphics[pointTable[[1 ;; #]], PlotRange -> {{-5, 5}, {-3, 3}},
Axes -> True, Ticks -> None]] & /@ Range[20] // Row
`

There may be a version with less code.