Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Locators stuck together' topicStudent Support Forum > General > "Locators stuck together"

Help | Reply To Topic
Author Comment/Response
William Stewart
06/27/13 02:28am

This problem I'm having was originally posted by Dims in 2011 but didn't it seems get resolved. Here is what s/he said:
01/03/11 3:17pm

In the code below 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? How to make both locators move independently along with plot?

URL: ,

URL: ,
Help | Reply To Topic