3
$\begingroup$

Using Tooltip, is it possible to display the numeric value of the curve I've plotted using Plot and PolarPlot?

For example, is it possible to display the numeric y value of Sin[x] (or any other curve) with Tooltip?

$\endgroup$
2
$\begingroup$

I thought I did something like the following before, but maybe it was not for this site:

DynamicModule[{y0},
 EventHandler[
  Plot[Tooltip[Sin[x], Dynamic[y0]], {x, 0, 2 Pi}],
  "MouseMoved" :> (y0 = Sin@First@MousePosition["Graphics"]),
  ]]
$\endgroup$
  • 2
    $\begingroup$ for minimal functionality this is enough Plot[Tooltip[Sin[x], Dynamic@MousePosition["Graphics"]], {x, 0, 2 Pi}] $\endgroup$ – Kuba Jul 14 '16 at 18:38
  • $\begingroup$ @Kuba D'oh! Thanks! (You can answer with that, if you like. But I'm tempted to close as dupe....) $\endgroup$ – Michael E2 Jul 14 '16 at 18:53
1
$\begingroup$

Potential way to achieve this:

pl = Plot[Sin[x], {x, 0, 10}];
vals = Table[Tooltip[{x, Sin[x]}, Sin[x]], {x, 0, 10, .05}];
lp = ListPlot[vals, PlotStyle -> None];
Show[{pl, lp}]
$\endgroup$

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.