Re: Locator question
- To: mathgroup at smc.vnet.net
- Subject: [mg79382] Re: Locator question
- From: Albert <awnl at arcor.net>
- Date: Wed, 25 Jul 2007 05:30:16 -0400 (EDT)
- References: <f86r55$pc7$1@smc.vnet.net>
Hi,
> You are right...it does work, however, I'd like to be able to have the locator track the function.
I'm not sure whether this is possible with Manipulate, but there are two
examples in the Documentation of LocatorPane which do what you need,
here is one of them:
LocatorPane[Dynamic[pt],
Plot[Sin[x], {x, 0, 10},
Epilog -> {PointSize[Large],
Point[Dynamic[{First[pt], Sin[First[pt]]}]]}], Appearance -> None]
There is also the possibility to not only make the position of the
locator, but also the actual coordinates reflect the restriction. But
for this you have to examine the advanced functionality of Dynamic, that
is it's second argument :-). This is drawn from an example form the
Documentation of Dynamic, combined with a LocatorPane and showing that
the coordinates are really restricted, not only the position of the locator:
DynamicModule[{p = {0, 0}}, Column[{
LocatorPane[
Dynamic[p, (p = {#[[1]], Sin[#[[1]]]}) &],
Plot[Sin[x], {x, 0, 10}]
],
Dynamic[p]
}]]
hth,
albert
- Follow-Ups:
- Re: Re: Locator question
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Locator question