Message Boards Message Boards

0
|
855 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to combine plot with dynamic graphic?

Posted 7 months ago

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?

POSTED BY: Todd Pytel
2 Replies

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.

POSTED BY: Gianluca Gorni
Posted 7 months ago

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.

POSTED BY: Todd Pytel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract