I have a heat map that I’d like to combine with an overlaying dynamic graphic (see attached notebook). I can’t figure out how to do this despite much googling and puttering. I’m sure I don’t understand the nuances of dynamic modules and how they interact with graphics sufficiently. Advice?
Have you tried Show?
dp = DensityPlot[a r + b, {x, y} \[Element] Disk[], Frame -> False];
DynamicModule[{pt = {0.5, 0}},
Show[dp,
Graphics[{
{Thick, Circle[]},
Line[{{0, 0}, Dynamic[pt]}],
Locator[Dynamic[pt, (pt = constrain[#]) &], None],
{EdgeForm[Thin], Opacity[0.05],
Disk[{0, 0}, Dynamic[pt[[1]]]]},
{PointSize -> 0.018, Point[Dynamic[pt]]}},
PlotRange -> 1.1]]]
The Dynamic stuff does not work.
Thanks, but I got it working another way just now. LocatorPane seems the right way to do this. Just drop your plot in as the background and you can create whatever other overlaying graphics you desire as Epilogs to the plot. Just bracket your dynamic variable/s with Dynamic[] wherever they comes up. Very cool.
In this particular case my Locator is bound to a line segment, so I could easily do this with Manipulate. But I’m a HS teacher and my main interest with Mathematica is creating visualizations for demonstrations. The ability to drag a point freely in 2D and generate dynamic graphics around that (shaded regions, slope triangles, etc.) is very powerful.