I an getting strange behavior with functions built using Tooltip.
I create a function to display the position of data in a list to be used in a ListLinePlot instruction.
positionTooltip0[data_] := Tooltip[#, Position[data, #]] & /@ data
But this function behaves oddly. There is a one unity shift on the display. That is nothing on the first curve and a shift of one unity on the others. Curiously, when I use ListLinePlot, I have the same behavior on the points but the right indication on the lines joining the points.
This behavior seems related to the presence of PlotMarkers option in ListLinePlot or ListPlot when there is no PlotMarkers option the positionTooltip0 function works fine.
Below a short example code
dat = {{{0.406992103446113`,
0.02599103089511951`}, {0.4033195231211961`,
0.03702670366733221`}, {0.39730038998662437`,
0.05041500199317847`}}, {{0.452337450835703`,
0.04830661684500813`}, {0.44762847518263227`,
0.05154124806027772`}, {0.44121850850474437`,
0.07119402422202213`}}, {{0.513970842412113`,
0.07295649689999566`}, {0.4968583868396515`,
0.08976996012774904`}, {0.49159468154666325`,
0.10013178421609562`}}};
temperature = {4.55948355`, 4.044779658333333`, 3.5275877374999998`};
positionTooltip0[data_] := Tooltip[#, Position[data, #]] & /@ data
(*plot with simple function*)
ListLinePlot[positionTooltip0[dat],
PlotMarkers -> Automatic, PlotStyle -> Automatic, PlotRange -> All]
(*more elaborated function displaying the temperature*)
positionTooltip2[data_] :=
Tooltip[#,
"n=" <> ToString[Flatten[Position[data, #]][[1]]] <> ", T=" <>
ToString[temperature[[Flatten[Position[data, #]][[1]]]]] <> " K"] & /@ data
(*plot using elaborated function*)
ListLinePlot[positionTooltip2[dat],
PlotMarkers -> Automatic, PlotStyle -> Automatic, PlotRange -> All]
Attachments: