Why are both locators moving?
- To: mathgroup at smc.vnet.net
- Subject: [mg115230] Why are both locators moving?
- From: Dims <dims12 at hotmail.com>
- Date: Tue, 4 Jan 2011 18:49:50 -0500 (EST)
In the code below I expect that locators can be moved independently,
but actually locator p1 causes locator p2 to move too if both
conditions occure:
1) any "Plot" instruction presents within Show
2) a=p1; presents within Dynamic
p1 = {0, 0}
p2 = {0, 1}
Dynamic[
a = p1; (* condition 1 *)
Show[
Plot[Cos[b],{b,1,2}], (* condition 2 *)
Graphics[Line[{{0, 0}, {1, 1}}]],
Graphics[Locator[Dynamic[p1]]],
Graphics[Locator[Dynamic[p2]]],
PlotRange -> {{-10, 10}, {-1, 1}}, Axes -> True, AspectRatio -> 1
]
]
My question is: why? Is it a bug or by-design behavior? Where is the
value for p2 assigned?
How to make both locators move independently along with plot?