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:


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 3


Some test data:

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

Simple line case:

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

Circular case:

AnnulusForm[inner_, outer_][vector_List] :=
    {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}] &];



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

ListAnimate @ f2 @ array

enter image description here



  Table[(*of frames*)
      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]]]]}]},

Adjust point size as needed for your actual data


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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