# VectorPoints doesn't accept value of 1?

I am trying to plot a 3D vector field with VectorPlot3D but I want it only evaluated across the $xy$-plane. I.e. I want the vectors in 3-space pointing out of the $xy$-plane, but I only want one "layer" of them vertically (where $z = 0$). But when I specify VectorPoints -> {8, 8, 1} as an option to VectorPlot3D it throws an error Value of option PlotPoints -> {8,8,1} is not an integer >= 2.

Here is an example of what I am trying to achieve:

I hacked this together by ploting it with a large $z$ range and PlotPoints -> {8,8,3}, then photoshopping out the top and bottom layers of vectors. But this is really klunky and annoying as I have several of these to do.

This minimum bound of 2 for the evaluation point resolution seems pretty arbitrary and weird, not to mention really annoying for my purposes. Is there any way I can achieve what I am attempting to?

• Dec 14, 2016 at 5:54
• @SimonRochester Almost, it seems the OP there only wants one arrow total, I want multiple vectors but only one in the $z$-direction. I'll try to apply some of those here though. It baffles me that this may be impossible since this seems it should be a pretty simple task. Dec 14, 2016 at 6:29
• Specifying an explicit list of VectorPoints seems to work. You could also try using PlotRange to trim out the unwanted vectors in the z direction. Dec 14, 2016 at 8:23
• Please post code so that we can reproduce the issue. Dec 14, 2016 at 9:12
• @C.E. Just put VectorPoints -> {8, 8, 1} as an option to VectorPlot3D, and it will complain the value isn't >= 2. Dec 14, 2016 at 14:53

VectorPoints has an alternate syntax that lets you specify an explicit list of coordinates where you want the vectors placed. VectorPlot3D doesn't complain if they're all in the same plane, as long as there are at least two points in total:

VectorPlot3D[{0, 0, Sin[Pi x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
VectorPoints -> Flatten[Table[{x, y, 0}, {x, -1, 1, .25}, {y, -1, 1, .25}], 1],
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
]


You could also plot more vectors than you want in the z direction and then trim them out using PlotRange:

VectorPlot3D[{0, 0, Sin[Pi x]}, {x, -1, 1}, {y, -1, 1}, {z, -2, 2},
VectorPoints -> {8, 8, 3}, VectorScale -> .1,
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
]


Or you could delete the unwanted arrows entirely from the graphics object:

DeleteCases[
VectorPlot3D[{0, 0, Sin[Pi x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
VectorPoints -> {8, 8, 3}, VectorScale -> .1,
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
],
Arrow[{{_, _, z1_}, {_, _, z2_}}] /; Mean[{z1, z2}] != 0,
Infinity
]


Or you could set the vector field to zero for z != 0:

VectorPlot3D[
If[Abs[z] < .01, {0, 0, Sin[Pi x]}, {0, 0, 0}], {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
VectorPoints -> {8, 8, 3}, VectorScale -> .1, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
]