Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: Re: Tooltips in ContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81820] Re: [mg81759] Re: [mg81726] Tooltips in ContourPlot
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Thu, 4 Oct 2007 04:23:41 -0400 (EDT)
  • References: <200710020940.FAA28639@smc.vnet.net> <4534823.1191418739506.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

For another surprise (to me, anyway), try

cp = ContourPlot[
   Tooltip[Re[Cosh[x + I y]] == Re[Sin[x + I y]],
    "expr1==expr2"], {x, -6, 6}, {y, -6, 6}];
Cases[cp, _Tooltip, Infinity]

You'll see a List of Line (not Tooltip) objects, but mousing over them  
you'll see Tooltip values.

Each Line argument is a list of 4 to 5-digit integers, not pairs of reals  
between -6 and 6. These are the integer coordinates mentioned in docs for  
GraphicsComplex... an integer for each pixel pair position, or something 
like that.

A little sleuthing reveals the meaning of the Tooltips:

cosh[{x_, y_}] = Re[Cosh[x + I y]];
sin[{x_, y_}] = Re[Sin[x + I y]];

Cases[Normal@cp,
  Tooltip[Line[pts_], _] :> Mean[sin /@ pts - cosh /@ pts], Infinity]

{-99.9809, -99.9585, -99.9876, -99.9933, -99.9806, -99.9628, \
-99.9742, -99.9859, -49.9336, -49.9866, -49.954, -49.9861, -49.9959, \
-49.9675, -49.9887, -49.9845, 0.000421893, 0.0288174, 0.000155635, \
0.0337384, 0.000478683, 0.000501818, 0.00087235, 0.00470766, 49.9949, \
49.9944, 49.9797, 50.0086, 50.0067, 49.9776, 49.9867, 49.991, \
99.9719, 99.9705, 99.9789, 99.9842, 99.9602, 99.9793, 99.975, \
99.9726, 150., 149.978, 150.014, 149.968, 149.964, 149.979, 149.978, \
149.974, 200.003, 199.979}

Cases[Normal@cp,
  Tooltip[Line[pts_], _] :>
   Variance[sin /@ pts - cosh /@ pts], Infinity]

{0.0303026, 0.0131712, 0.0147298, 0.0129718, 0.00911339, 0.0283497, \
0.0072773, 0.0059341, 0.0161148, 0.00872554, 0.0154022, 0.00759067, \
0.00581582, 0.00918541, 0.00552482, 0.0116748, 0.00109861, 0.0205724, \
0.00574259, 0.0220134, 0.0039621, 0.00109243, 0.00330027, 0.0036575, \
0.00533634, 0.0111515, 0.010219, 0.0114676, 0.0135777, 0.0195418, \
0.0079861, 0.00711254, 0.00709383, 0.0215884, 0.00628416, 0.00685311, \
0.0144257, 0.00924261, 0.00888654, 0.0219085, 0.0112233, 0.00559716, \
0.0134408, 0.0145944, 0.0118609, 0.0091532, 0.0126382, 0.00683607, \
0.00679395, 0.00326373}

So the Tooltip values are differences between the LHS and RHS of the  
original equation.

Most of the contour lines are NOT solutions of the equation, obviously, 
and they're very approximate contours, as well. Eliminating Tooltip from 
the argument and setting MaxRecursion gives more accurate contours and  
eliminates those that don't solve the equation:

cp1 = ContourPlot[
   Re[Cosh[x + I y]] == Re[Sin[x + I y]], {x, -6, 6}, {y, -6, 6},
   MaxRecursion -> 5]
Cases[Normal@cp1,
  Tooltip[Line[pts_], _] :> Mean[sin /@ pts - cosh /@ pts], Infinity]
Cases[Normal@cp1,
  Tooltip[Line[pts_], _] :>
   Variance[sin /@ pts - cosh /@ pts], Infinity]

Bobby

On Wed, 03 Oct 2007 01:25:16 -0500, Syd Geraghty <sydgeraghty at mac.com>  
wrote:

> David,
>
> I have had no luck after about 30 minutes scouring the documentation.
>
> By analogy with Plot
>
> Plot[Tooltip[Sin[x], "sine"], {x, 0, 10}]
>
> should give you what you want but does not.
>
> Try
>
> ContourPlot[
>   Tooltip[Re[Cosh[x + I y]] == Re[Sin[x + I y]], "expr1==expr2"], {x,
> -6,
>    6}, {y, -6, 6}]
>
> for an unexpected result.
>
>
> I hope someone comes up with an answer because tooltips documentation
> for ContourPlot indicates that
> it should work like tooltips for Graphics but it does not seem to.
>
> Syd Geraghty B.Sc., M.Sc.
> sydgeraghty at mac.com
> San Jose, CA
>
> On Oct 2, 2007, at 2:40 AM, David Park wrote:
>
>> Is it possible to control what is displayed in Tooltips in contour
>> plots?
>> For example, in the following plot:
>>
>> ContourPlot[
>>  Re[Cosh[x + \[ImaginaryI] y]] ==
>>   Re[Sin[x + \[ImaginaryI] y]], {x, -6, 6}, {y, -6, 6}]
>>
>> would it be possible to change the Tooltip to Re[Cosh[z]] == Re[Sin
>> [z]] or
>> to some descriptive text?
>>
>> --
>> David Park
>> djmpark at comcast.net
>> http://home.comcast.net/~djmpark/
>>
>>
>>
>
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Strange result for a definite integral: Unknown Symbol (\.10) returned
  • Next by Date: Re: Number of interval Intersections for a large number of
  • Previous by thread: Re: Re: Tooltips in ContourPlot
  • Next by thread: Re: Tooltips in ContourPlot