Fwd: Re: tooltip - evaluate function at point
- To: mathgroup at smc.vnet.net
- Subject: [mg98794] Fwd: Re: tooltip - evaluate function at point
- From: "Cristina Ballantine" <cballant at holycross.edu>
- Date: Sun, 19 Apr 2009 04:55:22 -0400 (EDT)
David's answer completely solved my problem.
Thank you!
Cristina
-----------------------------
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 <dreiss at scientificarts.com> 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 <dreiss at scientificarts.com> 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, as
>>that tooltip seems to preempt any other tooltip that is imposed on the plot
>>as I did.
>>
>>....Ah, this seems to do the trick, I think, using the option ContourLabels
>>-> 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 <cballant at holycross.edu
>>> wrote:
>>
>>> David,
>>>
>>> Thank you for your help. Unfortunately, this shows the value of Gamma at
>>> 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 curve the
>>> tooltip gives only "Arg[Gamma[x+I*y]]==0. But I am interested in the 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 and
>>> > add a tooltip that evaluates a different function at the points on the
>>> > 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, any
>>> > 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.
--=__Part7A52D74A.0__=--