Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
1  
you want numbers instead of the points? –  rm -rf 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
add comment

2 Answers

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 –  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
1  
@Verde This is probably the question you're thinking of... –  rm -rf Aug 15 '12 at 17:18
add comment

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
add comment

Your Answer

 
discard

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.