# How can I animate a list of vectors, which have entries either 1 or 0?

I have a list of vectors of equal length, that have entries either 1 or 0. I want to animate them vector by vector, essentially having one long string of the length of the vectors, which is black where the vector is 1 and white where the vector is 0. For the first frame the string is vector 1, for the second frame the string is vector 2,... for the n´th frame the string is vector n and so on. Bonus points if this string is in a form of a circle.

If for example we deal with the following vectors:

{{1,0,0,0,1},{0,1,0,0,1},{1,0,1,0,0}}


Then the frames would essentialy look like this:

Frame1: MatrixPlot[{1,0,0,0,1}], Frame2: MatrixPlot[{0,1,0,0,1}], Frame3: MatrixPlot[{1,0,1,0,0}]


And if You want to try to do it around in the circle, just imagine the Frame1 would be wrapped around in a circle with an outer radius and an inner radius. And then Frame2 would be wrapped around in the same fashion. The image belows illustrates it:

## 3 Answers

Some test data:

bitWords = RandomInteger[{0, 1}, {20, 5}]


Simple line case:

frames = ArrayPlot[{#}] & /@ bitWords;
ListAnimate[frames]


Circular case:

AnnulusForm[inner_, outer_][vector_List] :=
With[
{colors = GrayLevel /@ vector,
segments = Annulus[{0, 0}, {inner, outer}, #] & /@
Partition[Range[0, 2 Pi, 2 Pi/Length[vector]], 2, 1]},
Thread[{colors, segments}]];
ListAnimate[Graphics@*AnnulusForm[4, 5] /@ bitWords]

f2 = Map[PieChart[ConstantArray[1, Length @ #],
ChartStyle -> ReplaceAll[{0 -> White, 1 -> Black}] @ #,
SectorOrigin -> {Automatic, 1}] &];


Example:

SeedRandom[1];

array = RandomInteger[{0, 1}, {20, 10}];

ListAnimate @ f2 @ array


Try

m={{1,0,0,0,1},{0,1,0,0,1},{1,0,1,0,0}};
ListAnimate[
Table[(*of frames*)
Graphics[
Table[{(*of points*)
If[m[[j,i]]==1,Black,Green],(*use Green instead of White to see the point*)
PointSize[0.2],Point[{Cos[2 Pi i/Length[m[[1]]]],Sin[2 Pi i/Length[m[[1]]]]}]},
{i,1,Length[m[[1]]]}]],
{j,1,Length[m]}]]


Adjust point size as needed for your actual data