# Possible to dynamically redraw single plot of multiple shown together?

I am attempting to create a tool to visualize gradient, eigenvector, and eigenvalue information for a 2D surface. I want to show a contour plot of an inputted function and overlay the gradient and eigenvectors based at a point selected by a Locator. The problem is when I move the Locator point the contour plot redraws -- which is slow. So I'd like for the gradient and eigenvector information to change but the contour plot to stay (unless the function is changed).

Manipulate[
Module[{},
p1 = ContourPlot[expr /. {x -> x, y -> y}, {x, -5, 5}, {y, -5, 5}, Contours -> 20];

p2 = Graphics[{Red, Arrow[{pt, pt + ngrad}]}];

Show[p1, p2]
],
{{pt, {1, 1}}, {-5, -5}, {5, 5}, Locator},
{{expr, 2*x*Cos[y] - x*y + 10, "f(x,y)"}, InputField},
{locx, pt[], InputField},
{locy, pt[], InputField},
{locval, expr /. {x -> pt[], y -> pt[]}, InputField}]


I expect this can be done using Dynamic, but everything I've tried so far has not worked. Any help would be greatly appreciated.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Jan 24 '15 at 21:41

Everywhere wrapping pt in Dynamic allows it to be updated without triggering changes in the CountourPlot, which is independent of pt:

Manipulate[Module[{},
p1 = ContourPlot[expr /. {x -> x, y -> y}, {x, -5, 5}, {y, -5, 5},
Contours -> 20]; grad = D[expr, {{x, y}}];