# ListPlot with labels that appear when the pointer goes over the points

I would like to generate a ListPlot with labels that appear when the pointer goes over the individual points. Specifically, I have a table of dimensions {100,3} and I want to use the first two columns for the plot and the third for the label.

Does anyone know how to do that?

-
Maybe something like: ListPlot[Tooltip@Prime[Range[25]], Filling -> Axis]. Is that what you try to do? – Pinguin Dirk Feb 1 '13 at 14:55
Thanks! It is almost what I want. Say that I have a table tab of dimensions {100,3} and I want to use the first two columns for the plot and the third for the label. Do you know how to do that? – Valerio Feb 1 '13 at 15:04
Please update your question with the additional information you supplied in your comment. It makes the question quite different than as originally posted. – m_goldberg Feb 1 '13 at 15:31
Also have a look at BubbleChart. – Jens Feb 1 '13 at 17:39

Based on update question: It seems that ListPlot cannot handle Tooltip "directly", so I used a Table to add a Tooltip to each point.

I use the following random data:

data = Append[#, RandomChoice[{"label1", "label2", "label3"}]] & /@
RandomInteger[100, {10, 2}]

(*{{80, 14, "label1"}, {98, 70, "label1"}, {66, 86, "label3"}, {43, 90,
"label2"}, {82, 29, "label2"}, {65, 91, "label1"}, {68, 59,
"label3"}, {9, 56, "label1"}, {17, 50, "label2"}, {79, 99,
"label3"}}*)


And then plot:

ListPlot[Table[Tooltip[data[[i, 1 ;; 2]], data[[i, 3]]], {i, Length@data}]]


Is this what you wanted?

EDIT

Based on Mr.Wizard's comment (see below), we can also concisely write:

ListPlot[Tooltip[{#, #2}, #3] & @@@ data]

-
added pictures... ;) – cormullion Feb 1 '13 at 16:35
@cormullion: thanks! that's something I never really understood on my mac... – Pinguin Dirk Feb 1 '13 at 16:38
You can use QuickTimePlayer to record the screen, then import the file and export it to animated GIF. Of course, embedded movies would be easier... – cormullion Feb 1 '13 at 16:46
ah thanks, I'll try that! (for next time) – Pinguin Dirk Feb 1 '13 at 16:54
Good answer. However, you should read this, and then understand: ListPlot[Tooltip[{#, #2}, #3] & @@@ data] – Mr.Wizard Mar 13 '13 at 16:07