Message Boards Message Boards

0
|
11107 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

ListPlot and Tooltip

I would like to associate a date as a tooltip on a ListPlot with about 25 x,y pairs. I'm not including sample data because the problem is so simple, but I can if it's necessary.  I can't find an example of how to do it in the documentation, and the usual places on the internet seem to think it can't be done. Does tool tip work in ListPlot?  If so, how do you do it?

I found an answer to a related question on StackExchange

Extracting the coordinate of a particular point of interest from a ListPlot

but it shows how to use a popup to display the values (x,y) for a plotted point, but it doesn't seem to work with unrelated lables, like the date when a point occured.
POSTED BY: George Wolfe
4 Replies
data = Table[Tooltip[Random[], DateList[{2014, 4, i}]], {i, 1, 25}]

ListPlot[data]
POSTED BY: David Reiss
Do you mean something like this?
data = Table[{i, Prime[i]}, {i, 25}];
ListPlot[Tooltip[#, DateString[]] & /@ data]

POSTED BY: Vitaliy Kaurov
Very nice, David, we finally got to the point where folks simultaneously answer questions ;-)
POSTED BY: Vitaliy Kaurov
Not quite.  I'm looking at a 25 value subset of 200 values which were generated over 200 months. A few of the values (not chronologically ordered) are anomalous. I want to make it easy to see when they happened.  So each point has a different date.  I've got the list of the dates when the values were generated.

I just saw David's answer, which seems to do what I want to do.
POSTED BY: George Wolfe
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract