Version 9, windows 7:

When I use ListLinePlot Tooltip does not work any more. It seems to have been lost somewhere. With same data, Tooltip works ok using ListPlot.

data = Table[Tooltip[{x, x^2}], {x, 0, 10, .1}];
(* Tooltip shows ok *)

(* Tooltip does not show up *)

enter image description here

Looked at possible issues for ListLinePlot and do not seen mention of this.

question: How to make Tooltip work with ListLinePlot


  • $\begingroup$ I get tool-tips from ListLinePlot in version 7. Should this be tagged version-9? $\endgroup$ – Mr.Wizard Dec 18 '12 at 8:53

Well it will get lost even in the case of ListPlot if you go to continuous solid line case:

ListPlot[data, Joined -> True]

In both cases the fix is to bring back points somehow, for example using Mesh:

ListLinePlot[data, Mesh -> All, MeshStyle -> Opacity[0]]

OR any similar trick in that manner:

Show[ListLinePlot[data], ListPlot[data, PlotStyle -> Opacity[0]]]

The reason for this is probably the fact that in bare solid-line case you get only line segments in resulting Graphics primitives (check with InputForm[..."your plot"...]). And line segments are wrong to wrap Point tool-tips around.

@MikeHoneychurch recommendation will work too; if you want to see only the solid line (with no point marks) something like empty string this will do

ListLinePlot[data, PlotMarkers -> ""]

To answer Mike's comment on Tooltip on line segments - it does work if constructed properly, for example (otherwise mma wouldn't know what to show when mouseover happens, I think):

data = Table[{x, x^2}, {x, 0, 10, .1}];
Graphics[Tooltip[Line[#]] & /@ Partition[data, 2, 1]]
  • $\begingroup$ Alternatively you could add plot markers to enable the tooltips. $\endgroup$ – Mike Honeychurch Dec 18 '12 at 3:30
  • $\begingroup$ @MikeHoneychurch thanks Mike, updated. +1 to you btw. $\endgroup$ – Vitaliy Kaurov Dec 18 '12 at 3:38
  • $\begingroup$ @MikeHoneychurch I added some thoughts in the answer. $\endgroup$ – Vitaliy Kaurov Dec 18 '12 at 3:47

As Vitaly has indicated, you need to have a point to tooltip over. Another approach is to add plot markers -- not suitable if a large number of points present:

data = Table[Tooltip[{x, x^2}], {x, 0, 10, .1}];
ListLinePlot[data, PlotMarkers -> Automatic]


As per my conversation with Vitaly you can tooltip your line. I had forgotten about that.

data = Table[{x, x^2}, {x, 0, 10, .1}];
ListLinePlot[Tooltip[data, "this line is my data"]]
  • $\begingroup$ I think ti works like this: Graphics[{Tooltip[Line[RandomReal[1, {15, 2}]], "hello"]}] $\endgroup$ – Vitaliy Kaurov Dec 18 '12 at 4:06
  • $\begingroup$ Yes you're right. I thought I'd tried that once and it didn;t work. oh well! $\endgroup$ – Mike Honeychurch Dec 18 '12 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.