I want to use Listplot
with Tooltip
that displays Position
of the element I'm hovering over.
data={{0,1},{1,3},{2,2}};
ListPlot[Tooltip[data]]
This is displaying the value of the element. Can I use the Position
function in the tooltip?
Map
and MapIndexed
solutions are formally valid but Thread
is often cleaner. (Poor guy is also underused, I believe.)
data = RandomInteger[10, {10, 2}];
ListPlot@Thread@Tooltip[#, Range@Length@#]&@data
data = Sort@RandomInteger[10, {10, 2}];
tts = {Directive[Red, 16, Bold], CellFrame -> 3, CellFrameMargins -> 5};
ListPlot[MapIndexed[Tooltip[#, First@#2, TooltipStyle -> tts] &, data],
PlotStyle -> PointSize[Large], Frame -> True, AxesOrigin -> {0, 0}]
ListPlot[Tooltip[#, Position[data, #][[1, 1]]] & /@ data]
? $\endgroup$