# How to animate a graph generated by ListPlot command point by point?

I was wondering if it is possible to animate the following graph.

The command used to generate the graph is the following:

ListPlot[{{{1, 1}}, {{1, 2}}, {{1, 3}}, {{1, 4}}, {{2, 1}}, {{2,
2}}, {{3, 1}}, {{3, 2}}, {{4, 1}}, {{4, 2}}},
PlotMarkers -> {{"\[Pi]", Large}, {"8", Large}, {"9", Large}, {"10",
Large}, {"2", Large}, {"5", Large}, {"3", Large}, {"4",
Large}, {"1", Large}, {"\!$$\*SqrtBox[\(2$$]\)", Large}},
Ticks -> {{1, 2, 3, 4}, {0, 1, 2, 3, 4}},
AxesLabel -> {"Number of columns", "Size of the columns"},
AxesStyle -> Directive[Black, Thick, 20, Arrowheads[0.03]],
PlotRange -> {{0, 5}, {0, 5}},
PlotStyle -> Directive[Black, Thick, Large],
LabelStyle -> Directive[Thick, Large],
TicksStyle -> Directive[Black, Thick, 20], ImageSize -> Large]


Ideally, I would like to animate a graph where I arrange the numbers of the sequence $(\pi,2,8,9,5,10,3,4,1,\sqrt{2})$ using Hammersley's argument (see J. Michael Steele, "Variations on the Monotone subsequence theme of Erdős and Szekeres") .

So, first $\pi$, then $2$ in the next column, then $8$ and $9$ above $\pi$ and so on.

I would greatly appreciate any suggestion or hint.

Thank you.

• For completeness, can you give a reference for this? – J. M.'s ennui Nov 24 '15 at 14:52
• @J.M. What do you mean? – johnny09 Nov 24 '15 at 14:58
• From what book/paper/whatever did you see "Hammersley's argument"? – J. M.'s ennui Nov 24 '15 at 15:04
• @J.M. Okay, thanks. I have edited my question. – johnny09 Nov 24 '15 at 15:06

Here's how I understand your question:

hammersley = With[{k = If[#1 === {}, {}, Position[Last /@ #1, x_ /; x < #2]]},
If[k === {}, Append[#1, {#2}],
MapAt[Function[l, Append[l, #2]], #1, First[k]]]] &;

myList = {π, 2, 8, 9, 5, 10, 3, 4, 1, Sqrt[2]};

gathered = Rest[FoldList[hammersley, {}, myList]];

ListAnimate[
Graphics[MapIndexed[Text, #, {2}],
PlotRange -> Transpose[{{1, 1}/2, dims + 1/2}]] &
/@ gathered]


With axes:

ListAnimate[
Graphics[MapIndexed[Text, #, {2}], Axes -> True,
PlotRange -> Transpose[{{0, 0}, dims + 1/2}]] &
/@ gathered]


• Thank you for the answer. Although, is it possible to include the axes? And also how did you export it as a gif? – johnny09 Nov 24 '15 at 18:42
• I can do the axes, but maybe later. As for exporting, I used Export[] instead of ListAnimate[]. – J. M.'s ennui Nov 24 '15 at 18:46
• J.M., I would like to know that did you have a copy of this paper :The insertion algorithm. The lbrary of our university doesn't buy the paper that published before 1993. – xyz Nov 27 '15 at 7:35
• @J.M. I cannot understand the algorithm 5.4 of Knot Refinement in page 165 of "The NURBS Book" without that paper. – xyz Nov 27 '15 at 7:41