1

Problem with ListPlot when each point has a Tooltip and there are exactly two points(or for a multi-plot Listplot[{list1, list2...}] with individual Tooltips per point and each plot having exactly two points).

The points don't appear on the plot (or the associated tooltips) in the 3rd and 4th case below.

1 point is ok, also 3 points or more is ok. I thought it might be to do with two points maybe being just outside the plot region, but extending PlotRangePadding and PlotRange didn't reveal the points.

Any ideas for a workaround? I've submitted this to support in case it is a bug.

ListPlot[{{{1, 1}, {2, 2}}, {{1, 1}, {2, 2}}}]
ListPlot[{{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"]}, {Tooltip[{1, 1}, "1b"]}}]
ListPlot[{{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"]},
          {Tooltip[{1.1, 1}, "1b"], Tooltip[{2.1, 2}, "2b"]}}]
ListPlot[{{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"]}}]
ListPlot[{{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"], Tooltip[{3, 3}, "3"]}}]
ListPlot[{{Tooltip[{1, 1}, "1"]}}]

Mathematica graphics

Öskå
  • 8,587
  • 4
  • 30
  • 49
DrBubbles
  • 1,391
  • 9
  • 17

1 Answers1

2

Appending an dummy "missing" point appears to work around this issue, e.g.:

test3 = {{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"]}, 
         {Tooltip[{1, 1}, "1b"], Tooltip[{2, 2}, "2b"], Missing[]}};
test4 = {{Tooltip[{1, 1}, "1"], Tooltip[{2, 2}, "2"], Missing[]}};
ciao
  • 25,774
  • 2
  • 58
  • 139
  • @rasger, Excellent solution! That prompted me to do:If[Length[data[[i]]==2,Append[data[[i]],data[[i]][[-1]]]] so for lists of lists where some have 2 points, it duplicates the last point (otherwise ListLogPlot wasn't happy with Missing[]) Thank you. – DrBubbles Jun 21 '14 at 15:53