# Applying a function to list of points and plot the results in ListPlot

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.

• 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

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)}


• 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... – rm -rf 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]