MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: tooltip - evaluate function at point

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98764] Re: tooltip - evaluate function at point
  • From: dbreiss at gmail.com
  • Date: Sat, 18 Apr 2009 03:38:42 -0400 (EDT)
  • References: <gs6pjo$h7i$1@smc.vnet.net> <gs9ejj$ms2$1@smc.vnet.net>

Just so folks see how this turned out.  Part of he problem is that
what works in Version 7 doesn't always work n version 6.  I created a
possible solution that works around the bug in ContourPlot from
veroins 6.

--D


To: "Cristina Ballantine" <>
From: David Reiss <>
Subject: [mg98764] Re: tooltip - evaluate function at point
Cc:
Bcc:
X-Attachments:

HI Cristina ,

Of course the important question at this point is to see whether we
are using the same version of Mathematica.  I am doing this with
Version 7 on OSX.  It seems to work for me both on the contour and off
of it.

I agree that the documentation for ContourLabels is somewhat obscure.

So, I just tested the code that I sent to you in Mathematica 6 and
indeed it does not behave properly.  Clearly there is a bug in version
6 that was fixed in version 7.

So I have to trick the whole graphics thing in Verions 6  to make this
work.  Try the following (I use a transparent rectangle above the
contourplot so that the Tooltip is getting its coordinates from the
rectangle rather than getting it from the buggy ContourPlot):

With[{plot =
   ContourPlot[Arg[Gamma[x + I*y]] == 0, {x, -10, 10}, {y, -10, 10},
    PlotPoints -> 20, ContourLabels -> None],
  rect = Graphics[{Opacity[0], Rectangle[{-10, -10}, {10, 10}]}]},

 Dynamic@
  Tooltip[Show[plot, rect],
   With[{z = Complex @@ MousePosition["Graphics"]}, {z, Gamma[z]}]]]

Best,

David


At 9:46 PM -0400 4/17/09, you wrote:


Hi David,

I copied and pasted the code and it does the exact same thing as the
previous code you wrote: it gives the value of Gamma at all points
other than the points on the curves. At the points of the curves it
just gives Arg[Gamma[x+I*y]]==0.

I couldn't find anything in the documentation of ContourLabels
referring to tooltip other than "The label can be any expression or
graphic, and can include constructs such as Tooltip" but I don't
understand what that means.  It seems to me that ContourLabels is just
a label on the contours on the plot. If specified, they appears
regardless of the position of the mouse. But maybe I am wrong.

Thanks again for your help.

Cristina

>>> David Reiss <> 04/17/09 9:05 PM >>>
Hi Crristina,

I am slightly puzzled.  The code that I wrote below does seem to do
exactly what you wish.  Also if you review the documentation for
ContourLabels you will see how it controls the tooltip.

Best regards,

David

At 8:43 PM -0400 4/17/09, you wrote:


>Hi David,
>
>Thank you for looking into this again. Unfortunately, ContourLables
>doesn't seem to be connected to Tooltip. There must be some other
>way to turn off the tooltip label and overwrite it with a new label.
>
>
>Best wishes,
>
>Cristina
>
>>>>  David Reiss <> 04/17/09 8:52 AM >>>
>Hi Cristina,
>The problem here seems to be that ContourPlot has built into it a tooltip
>that tells you which equation the contour lines correspond to.  This
>actually was what I thought was a bug in my example, but I realize that it
>is a "feature" of ContourPlot.  I have to think of how to turn that off, a=
s
>that tooltip seems to preempt any other tooltip that is imposed on the plo=
t
>as I did.
>
>....Ah, this seems to do the trick, I think, using the option ContourLabel=
s
>-> None]:
>
>With[{plot =
>    ContourPlot[Arg[Gamma[x + I*y]] == 0, {x, -10, 10}, {y, -10, 10},
>     PlotPoints -> 20, ContourLabels -> None]},
>  Dynamic@Tooltip[
>    plot, (With[{z = Complex @@ MousePosition["Graphics"]}, {z, Gamma[z]=
}])]]
>
>Yes, if you look up the ContourLabels documentation, this is indeed what's
>needed.
>
>
>Does this work for you?
>
>
>Best regards,
>
>
>David
>
>
>On Thu, Apr 16, 2009 at 9:50 PM, Cristina Ballantine <
>>  wrote:
>
>>  David,
>>
>>  Thank you for your help. Unfortunately, this shows the value of Gamma a=
t
>>  all points other than the points on the solution curves given by
>>  Arg[Gamma[x+I*y]]==0. When the mouse goes over the points on the cu=
rve the
>>  tooltip gives only "Arg[Gamma[x+I*y]]==0. But I am interested in th=
e value
>>  of Gamma precisely at the points on the curves above.
>>
>>  Best wishes,
>>
>>  Cristina
>>
>>  >>> <dbreiss at gmail.com> 04/16/09 8:09 PM >>>
>>  Here is the start of one sort of approach.  It seems ot have some
>>  bugginess though.  But perhaps this will get you going:
>>
>>  With[{plot =
>>    ContourPlot[Arg[Gamma[x + I*y]] == 0, {x, -10, 10}, {y, -10, 10},
>>     PlotPoints -> 20]},
>>   Dynamic@Tooltip[
>>    plot,
>>    (With[{z = Complex @@ MousePosition["Graphics"]},
>>      {z, Gamma[z]}])
>>    ]
>>   ]
>>
>>
>>
>>  I suspect that someone else will give you a more stable approach....
>>
>>  --David
>>
>>
>>
>>  On Apr 16, 4:18 am, "Cristina Ballantine" <cball... at holycross.edu>
>>  wrote:
>>  > I would like to plot the solutions to an equation using ContourPlot a=
nd
>>  > add a tooltip that evaluates a different function at the points on th=
e
>>  > solution. In particular, for the plot
>>  >
>>  > ContourPlot[Arg[Gamma[x + I*y]] == 0, {x, -10, 10}, {y, -10, 10},
>>  PlotPoints -> 20]
>>  >
>>  > when the cursor is over a solution point I would like the ToolTip to
>>  > display the value of Gamma at that point. Is this possible? If so, an=
y
>>  > suggestion is greatly appreciated.
>>  >
>>  > Cristina
>>
>>
>>
>
>
>--
>This message and any attachments, may contain confidential and/or
>legally privileged information.  If you are not the intended
>recipient of the message by the original sender, please destroy it.
>Message and attachments copyright (c) 2009, all rights reserved.  Any
>unauthorized dissemination, distribution or copying is strictly
>forbidden.


--

<><><><><><><><><>><><><>><><><>
    David Reiss, Ph.D;   Scientific Arts, LLC      .  
    http://www.scientificarts.com
<><><><><><><><><>><><><>><><><>
This message and any attachments, may contain confidential and/or
legally privileged information.  If you are not the intended
recipient of the message by the original sender, please destroy it.
Message and attachments Copyright (c) 2009, all rights reserved.


--

<><><><><><><><><>><><><>><><><>
   David Reiss, Ph.D;   Scientific Arts, LLC      .   
   http://www.scientificarts.com 
<><><><><><><><><>><><><>><><><>
This message and any attachments, may contain confidential and/or
legally privileged information.  If you are not the intended
recipient of the message by the original sender, please destroy it.
Message and attachments Copyright (c) 2009, all rights reserved.



  • Prev by Date: Re: Any way to make help browser remember the last
  • Next by Date: Abort/Interrupt doesn't work?
  • Previous by thread: Re: tooltip - evaluate function at point
  • Next by thread: Fwd: Re: tooltip - evaluate function at point