Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Assume there are three groups of 2-dimensional coordinates

data = RandomVariate[NormalDistribution[#, .25], {15, 2}] & /@ Range[3];

Is there a way to ListPlot these data points just like

ListPlot[data, PlotStyle -> {Red, Blue, Green}]

but instead of the dots with the result of an integer-valued function, e.g. Round[Norm[#]]&, shown in the according colour?

I already had a look at this and that question, but wasn't able to modify the answers to obtain the desired result.

share|improve this question
you want numbers instead of the points? – R. M. Aug 15 '12 at 16:41
Yes, each point should be the number resulting in applying to it a pre-defined function f:R^2 -> N in the colour as shown above. – Frederik Ziebell Aug 15 '12 at 16:48
up vote 5 down vote accepted

Not sure if this is what you had in mind, but you could do something like

ListPlot[data, PlotStyle -> {Red, Green, Blue}] /. 
   {Point[a_] :> (Text[Round[Norm[#]], #] & /@ a)}

Mathematica graphics

share|improve this answer
I think there was a question by Mr.W in SO showing that the points aren't shown in their correct positions with this technique. If my memory does not fail, the trick was rasterizing the symbols before plotting. Mmm ... I should check – Dr. belisarius Aug 15 '12 at 16:59
@Verde I missed that question. If I superpose the original ListPlot on top of the one above, the numbers seem to be shifted slightly with respect to the dots by a few pixels. I wonder what causes this. – Heike Aug 15 '12 at 17:13
@Verde This is probably the question you're thinking of... – R. M. Aug 15 '12 at 17:18

The numbers will confusingly overlap, especially with more precision shown. Just in case here is a solution with radius of disk reflecting the Norm and Tooltip showing the number?

Graphics[{Hue[RandomReal[], 1, 1, .4], 
    Map[Tooltip[Disk[#, .02 Norm[#]], Norm[#]] &, #]} & /@ data, Frame -> True]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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