This seems like a basic feature that is somehow missing. Ideally we'd get something like a tooltip which shows the x,y position where I click (or of where the mouse is currently hovering) and the evaluated vector (or scalar in the case of a scalar field) at that position. I think this would be a great way to "get a feel for" the values because by default the arrows are scaled automatically so they fit so I don't know anything about the relative magnitude of a particular arrow.

I have found that this is a good way to get a tooltip which displays the current mouse coordinates really well, but it obviously won't evaluate my vector field for me.

  • $\begingroup$ For the case of scalar field plot it's quite easy to see what's going on by just doing a 3D plot with it. $\endgroup$
    – Steven Lu
    Jul 5, 2012 at 4:30
  • 1
    $\begingroup$ Something like VectorPlot[{y, -x}, {x, -3, 3}, {y, -3, 3}] /. ar : Arrow[{p1_, p2_}] :> Tooltip[Arrow[{p1, p2}], p1]? $\endgroup$ Jul 5, 2012 at 4:37
  • $\begingroup$ @J.M. That's pretty good $\endgroup$
    – Steven Lu
    Jul 8, 2012 at 20:35

1 Answer 1


There are many ways to do this. For example, using LocatorPane. Imagine this is your vector function:

f[x_, y_] := {-1 - x^2 + y, 1 + x - y^2}

Now this will do the trick, where first line is the coordinate, and second is the function f evaluated at the coordinate. Red dot will follow the mouse. You can also bring the numbers with PlotLabel outside the graphics not to block the view.

DynamicModule[{pt = {1, 0}},LocatorPane[Dynamic[pt], 
  VectorPlot[f[x, y], {x, -3, 3}, {y, -3, 3}, StreamPoints -> Coarse, 
   StreamColorFunction -> Hue, Epilog -> Dynamic@Inset[{pt, f @@ pt}, pt], 
   PerformanceGoal -> "Quality"], AutoAction -> True, 
   Appearance -> Style["\[FilledCircle]", Red]]]

enter image description here

  • $\begingroup$ Since the plot itself is static you can also do VectorPlot[..., Epilog -> Dynamic[...]] instead of Dynamic[VectorPlot[....]]. On my system this makes the plot a lot more responsive. $\endgroup$
    – Heike
    Jul 5, 2012 at 9:04
  • $\begingroup$ @Heike Excellent point. The rule of thumb with Dynamic is to try bring it to the lowest level to avoid recomputing redundant things. I made the changes. $\endgroup$ Jul 5, 2012 at 9:24
  • $\begingroup$ This is beautiful. $\endgroup$
    – Steven Lu
    Jul 8, 2012 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.