# Labeling points of a list in plot

A list of georeferenced points is:

coord = {{3.54231*10^6, 5.43395*10^6}, {3.54235*10^6,
5.43395*10^6}, {3.54239*10^6, 5.43396*10^6}, {3.54231*10^6,
5.43398*10^6}, {3.54235*10^6, 5.43399*10^6}, {3.54239*10^6,
5.434*10^6}, {3.5423*10^6, 5.43402*10^6}, {3.54234*10^6,
5.43403*10^6}, {3.54238*10^6, 5.43404*10^6}, {3.54229*10^6,
5.43406*10^6}, {3.54233*10^6, 5.43407*10^6}, {3.54237*10^6,
5.43408*10^6}, {3.54228*10^6, 5.4341*10^6}, {3.54232*10^6,
5.43411*10^6}, {3.54236*10^6, 5.43412*10^6}}


I would like to label each point of this list with the number of the position of the point in this list. How can I do this?

## 3 Answers

BubbleChart with a custom function for the tooltip content:

 labelingfunc[v : {x_, y_, w_}, i_, ___] :=
Placed[Grid[{{"point ", i}, {"coordinates", {x, y}}}, Frame -> All,
Alignment -> Left], Tooltip];
BubbleChart[(Append[#, 1] & /@ coord),
ChartLabels -> Placed[Style[#, "Subsection"] & /@ Range[Length@coord], Center],
BubbleSizes -> {0.1, 0.1}, LabelingFunction -> labelingfunc] • @ kguler, this is a very nice idea, thanks a lot!! Harald – Harald Mar 21 '12 at 12:27
• @Harald, glad it may be useful. – kglr Mar 21 '12 at 12:31
• A perfect example of what I talked about here. +1 (Harald, if you read this comment, take no offense; I mean only that your question if fairly basic for the regulars around here, but kguler took it as an opportunity to give a much richer answer than might be given.) – Mr.Wizard Mar 22 '12 at 0:20

How about using Tooltips? For example:

ListPlot[MapIndexed[Tooltip[#1, First@#2] &, coord]] • @ R.M., thanks a lot for your tip!! Harald – Harald Mar 21 '12 at 11:17

After a method shown here:

c2 = Transpose[{coord, Range@Length@coord}];

{{xmin, xmax}, {ymin, ymax}} =
{{Min@#1, Max@#1}, {Min@#2, Max@#2}} & @@ (coord\[Transpose]);
dx = (xmax - xmin)/6; dy = (ymax - ymin)/6;
plotrange = {{xmin - dx, xmax + 2*dx}, {ymin - dy, ymax + dy}};

shiftText = dx/2;

Graphics[{Red, PointSize[0.02],
Map[{Point[#[]], Style[Text["Pt " <> ToString[#[]],
{#[[1, 1]] + shiftText, #[[1, 2]]}], 12, Black]} &, c2]},
PlotRange -> plotrange, AspectRatio -> 1/GoldenRatio,
ImageSize -> 500, Frame -> True] • Did you choose the Ordering[coord] labels for a particular reason? To make this consistent, you´d have to use c2 = Transpose[{Sort@coord, Ordering[coord]}] as well, right? – Yves Klett Mar 21 '12 at 9:50
• @ Yves, you are quite right. I have replaced it with Range@Length@coord. – Chris Degnen Mar 21 '12 at 10:15
• @ Yes and @ Chris, thanks a lot for your help!! Harald – Harald Mar 21 '12 at 11:16