2
$\begingroup$

I want to plot a vector field and I want it to only show the vectors at certain points. I can write the function in such a way that the points I want to see occur at integer values of two parameters. But I am unable to tell VectorPlot how to increment my parameters.

I notice that when making a Table, I'm able to write

[expr,{i,imin,imax,di}]

to increment $i$ by $di$ from $imin$ to $imax$, but if I try to add a fourth term like this when specifying ranges for my parameters in VectorPlot, it does not work. How can I accomplish the same effect in VectorPlot?

$\endgroup$

1 Answer 1

5
$\begingroup$

Use VectorPoints:

points = Flatten[Table[{x, y}, {x, 0, 3, 1}, {y, 0, 3, 1}], 1];
VectorPlot[{y, -x}, {x, -3, 3}, {y, -3, 3}, VectorPoints -> points,
 Epilog -> {Red, PointSize[Medium], Point[points]}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, did not know about VectorPoints. It seems odd one has to specify the points separately but ey it does the trick! $\endgroup$
    – j0equ1nn
    Sep 20, 2017 at 23:15

Your Answer

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

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