6
$\begingroup$

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?

$\endgroup$
11
$\begingroup$

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]

labeled bubbles

$\endgroup$
  • $\begingroup$ @ kguler, this is a very nice idea, thanks a lot!! Harald $\endgroup$ – Harald Mar 21 '12 at 12:27
  • $\begingroup$ @Harald, glad it may be useful. $\endgroup$ – kglr Mar 21 '12 at 12:31
  • $\begingroup$ 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.) $\endgroup$ – Mr.Wizard Mar 22 '12 at 0:20
6
$\begingroup$

How about using Tooltips? For example:

ListPlot[MapIndexed[Tooltip[#1, First@#2] &, coord]]

enter image description here

$\endgroup$
  • $\begingroup$ @ R.M., thanks a lot for your tip!! Harald $\endgroup$ – Harald Mar 21 '12 at 11:17
6
$\begingroup$

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[#[[1]]], Style[Text["Pt " <> ToString[#[[2]]],
       {#[[1, 1]] + shiftText, #[[1, 2]]}], 12, Black]} &, c2]},
 PlotRange -> plotrange, AspectRatio -> 1/GoldenRatio,
 ImageSize -> 500, Frame -> True]

enter image description here

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Yves Klett Mar 21 '12 at 9:50
  • $\begingroup$ @ Yves, you are quite right. I have replaced it with Range@Length@coord. $\endgroup$ – Chris Degnen Mar 21 '12 at 10:15
  • $\begingroup$ @ Yes and @ Chris, thanks a lot for your help!! Harald $\endgroup$ – Harald Mar 21 '12 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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