Re: How to get Tooltip value

*To*: mathgroup at smc.vnet.net*Subject*: [mg112878] Re: How to get Tooltip value*From*: Simon <simonjtyler at gmail.com>*Date*: Tue, 5 Oct 2010 03:05:01 -0400 (EDT)*References*: <i8c8rl$g73$1@smc.vnet.net>

On Oct 4, 9:04 pm, "James Brown" <J... at SETI.Net> wrote: > Is there a way to extract the value of a variable and display it with > Tooltip? > Example: > f[x_] := 1/x^2 > Plot[Tooltip[f[x],"Value of x is:" "(wish I knew)"],{x,0,100}] > > Thanks... Jim Here's an ugly hack: f[x_] := 1/x^2 p = Plot[f[x], {x, 0, 100}]; data = p[[Sequence @@ Position[p, Line[__]][[1]]]][[1]]; ListPlot[Tooltip[#, #] & /@ data, Joined -> True] But there are probably nicer solutions (eg use a locator constrained to the curve that follows the mouse that dynamically returns the position...) Simon