Re: Mouse-Over or Mouse-Click Values of Coordinates in Plot in Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg103671] Re: Mouse-Over or Mouse-Click Values of Coordinates in Plot in Manipulate
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 2 Oct 2009 08:22:07 -0400 (EDT)
- References: <h9srm3$p3g$1@smc.vnet.net> <ha21ds$nee$1@smc.vnet.net>
Nasser Abbasi wrote: > "Gregory Lypny" <gregory.lypny at videotron.ca> wrote in message > news:h9srm3$p3g$1 at smc.vnet.net... >> Hello everyone, >> >> Is there a way to include in Manipulate something like a tooltip, >> where the coordinates of a point in a plot appear where the user clicks. >> >> Regards, >> >> Gregory >> > > I know how to do it with discrete data. Here is an example > > data = Table[Tooltip[Sin[x]], {x, -Pi, Pi, Pi/100.}]; > ListPlot[data, Joined -> True] > > And now if you move the mouse over the plot, the y-value (i.e. sin(x) ) > value will be displayed, here is a screen shot > http://12000.org/tmp/093009/tooltip.PNG > > But with the direct plot command, I still can't figure it > > Plot[Tooltip[Sin[x]], {x, -Pi, Pi}] > > will display "Sin[x]", instead of the current value of it. As shown here: > http://12000.org/tmp/093009/tooltip2.PNG > > I tried using Dynamics and Annotation with Mousover to get it to work, but > no luck. I am sure some Mathematica expert here will have an answer on how > to do it with a direct plot command instead of discrete plot. > would the following be a starting point? Plot[Tooltip[Sin[x], Dynamic[MousePosition["Graphics"]]], {x, -Pi, Pi}] hth, albert