Re: How to get Tooltip value
- To: mathgroup at smc.vnet.net
- Subject: [mg112893] Re: How to get Tooltip value
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Tue, 5 Oct 2010 05:33:47 -0400 (EDT)
- References: <i8c8rl$g73$1@smc.vnet.net>
Am 04.10.2010 12:04, schrieb James Brown:
> 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}]
>
I think this should get you going:
Dynamic[CurrentValue[{"MousePosition", "Graphics"}]]
I found it works better to only extract the first value and calculate
the function value with that, otherwise the difference can become
irritating:
Plot[Tooltip[f[x],
Dynamic[{#, f[#]} &@CurrentValue[{"MousePosition", "Graphics"}][[1]]
]], {x, 0, 100}]
hth,
albert