Message Boards Message Boards

0 Replies
0 Total Likes
View groups...
Share this post:

"How can I set unique tooltips to each of a list of lines in ListLinePlot"?

Posted 10 years ago

In a simple study of a chaotic system (spring pendulum) I am looking at a variety of ways of presenting my results. One of the simplest should be a series of time snapshots of the pendulum bob position. I use NDSolve to get a function that returns the [x,y] coordinate of the bob at a series of time steps. At each step I update a list of curves by adding the latest{ {0,0},{x,y}} pair. Simply calling ListLinePlot with the list of curves as an argument gives me a 'ray' like picture as expected. My problem comes when I wish to specify a tooltip to each 'ray' that identifies the time associated with it. I've spent a couple of days on this and got nowhere. The code fragment attached shows one attempted solution where I assemble a list of tooltip time tags on a one-to-one match to the XY line data. All that happens is that every ray picks up the entire list of tooltips.

If I try to pair curve[i] and label[i] within the Tooltip expression, then I keep running up against the issue that an indexing variable in an implied loop cannot be used to access part of a list. By this I mean that if I try and evaluate something like aList[[i]],{i,10} then I get a message that the indexing variable i cannot be used to access part of the list. This is probably a scoping issue as the same example works if I explicitly write a While loop equivalent but that doesn't help with my ListLinePlot case!!

Many thanks for any help.

POSTED BY: David Mackay
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract