Skip to main content

plotting - Display function value on hover?


I have used Manipulate in conjunction with Plot to draw a function's graph and I would like to show the current x-axis value and function value while hovering over the function's plot. How can I achieve this?


Thanks.



Answer



Manipulate[
Module[{tbl},
tbl = Table[Tooltip[{x, Sin[a x]}], {x, -Pi, Pi, .1}];

ListLinePlot[tbl, Mesh -> All, MeshStyle -> Opacity[0]]
],
{{a, 1, "a?"}, .1, 5, .1}
]

Mathematica graphics


Comments