I want to figure out how to combine several graphics in manipulate such that only the ones that change are recomputed.
I looked into the tutorials on Advanced Manipulate, but couldn't figure out how to get this to work.
In the toy example below, I combine two graphics with Show. When I move the control for the point p, the ContourPlot also gets recomputed, which leads to a low-res drawing (in my actual example, the graphs are a lot more complex, so re-evaluating them, even when the relevant parameters don't change isn't an option). I tried using Dynamic, but couldn't find a solution that works. Any help highly appreciated!
Manipulate[
Show[ContourPlot[Cos[a x] + Cos[ a y], {x, 0, 1}, {y, 0, 1}],
Graphics[Disk[p, 0.02]]],
{{a, 10}, 0, 20},
{p, {0, 0}, {1, 1}}
]

Dynamic @ Disk[p, 0.02]– m_goldberg Jun 15 '17 at 11:02Disk[Dynamic@p, 0.02]will do. Will change this later, with comments. Wanted to show a general way meanwhile. – Kuba Jun 15 '17 at 11:09Frame->Trueor whatever you want toGraphics. Sure it depends what we need to beDynamic, FE understandsDynamiccoordinates in graphics primitives soDisk@Dynamic@pis a solution but not a general one. All those details will come in comments I'm going to ad once I find time. – Kuba Jun 16 '17 at 11:46