I am trying to create a Manipulate
module that shows two plots, and have locators on each of those plots, as well as two sliders. The locators do do not affect each other's position, but one of the locators affects both sliders, and vice versa. Here is a minimal version of my current code:
Manipulate[Row[{
Plot[(x - a)^2 + b, {x, 0, 1}, ImageSize -> Medium,
PlotRange -> {0, 1}],
Plot[{(x - pt[[1]])^2 + pt[[2]], b}, {x, 0, 1}, ImageSize -> Medium,
PlotRange -> {0, 1}, GridLines -> {{a}, {}},
Epilog -> {PointSize[Large], Point[Dynamic@{a, b}]}]}],
{a, 0, 1}, {b, 0, 1}, {{pt, {0, 1}}, Locator}]
This is a screenshot of the scenario:
In the code above only one locator is declared. The other locator I would like to declare should be at {a,b}
in the second plot. I've made the point Dynamic
, but it doesn't do anything when I try to click-drag with my mouse. I've seen this question about locators and sliders affecting each other, but there only one graph has an interactive locator, and I would like both to have an interactive locator. I also tried to get some intuition from this question about specifying which element of Grid
a locator should affect, but I am not an expert Mathematica user, so I couldn't adapt it.
So, my question is:
How can I get two independent locators, each in a different plot, one of which depends on sliders?
{a, b}
in the second plot, and moving it should change thea
andb
sliders. This also affects the first plot. $\endgroup$