Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: Dynamic PlotLabel in Math6?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76297] Re: [mg76224] Re: Dynamic PlotLabel in Math6?
  • From: "Lev Bishop" <lev.bishop+mathgroup at gmail.com>
  • Date: Sat, 19 May 2007 04:38:23 -0400 (EDT)
  • References: <f2el71$25e$1@smc.vnet.net> <200705181007.GAA12845@smc.vnet.net>

On 5/18/07, Albert wrote:
> W. Craig Carter wrote:
> > It would be convenient if this construction would work in
> > math6:
> > Plot[{Annotation[Sin[x], "Sine", "Mouse"], Annotation[Cos[x], "Cosine", "Mouse"]}, {x, 0, 2 \[Pi]},
> >   PlotStyle -> Thick, PlotLabel -> Dynamic[MouseAnnotation[]]]
> > (i.e., use the label as a dynamic legend)
> >
> > This kind of works, if you know a priori to click and
> > pull up the pop-up window:
> > PopupWindow[
> >   Plot[{Annotation[Sin[x], "Sine", "Mouse"],
> >     Annotation[Cos[x], "Cosine", "Mouse"]}, {x, 0, 2 \[Pi]},
> >    PlotStyle -> Thick], Dynamic[MouseAnnotation[]]]
> >
> > Any ideas on how to make the first construction work
> > dynamically?
> >
> > Craig
>
> Looks like changing the PlotLabel directly is not possible, presumably
> because the information is just in the options of the Graphics. But
> there are workarounds (for me for some reason the AspectRatio changes
> with the first version):

No, with the above code you are actually changing the plotlabel so
many times per second that it looks like it isn't changing (but open
task monitor and look at the cpu load!).

The problem seems to be that changing the plotlabel for an object
means that the mouseover state needs to be refreshed for that object,
which means that the plotlabel needs to be refreshed, which means...
an so on in a tight loop so long as the mouse is in the graphics
object. Either of the following will work though:

Plot[{Annotation[Sin[x],"Sine","Mouse"],Annotation[Cos[x],"Cosine","Mouse"]},{x,0,2
\[Pi]},PlotStyle->Thick,PlotLabel->Dynamic[MouseAnnotation[],SynchronousUpdating->False]]

Labeled[Plot[{Annotation[Sin[x],"Sine","Mouse"],Annotation[Cos[x],"Cosine","Mouse"]},{x,0,2
\[Pi]},PlotStyle->Thick],Dynamic[MouseAnnotation[]],Top]

The second is more efficient/smooth because it doesn't involve the kernel.

You could also use Tooltip[] or StatusArea[] instead of Annotation[]
for a different effect, if you like those better (don't have to click
like with PopupWindow[])

Lev


  • Prev by Date: Re: Mathematica 6.0 and MatrixManipulations
  • Next by Date: Re: Close Evaluation Cell in Version 6.0
  • Previous by thread: Re: Dynamic PlotLabel in Math6?
  • Next by thread: Subject of Formular