8
$\begingroup$

Here is what I get when simply evaluating the example in the documentation:

enter image description here

This is on Win7 x64. I can see some vectors if I do something like

VectorPlot3D[{1, 1, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, VectorPoints -> 2]

but the plot I get:

enter image description here

has all vectors parallel to the z-axis and thus makes no sense.

Update:

I played around with this some more, and found that wrapping the vectorfield argument in a Hold fixes the issue: Following david's comment, instead of using Hold, we can just put curly braces around the vector field, which would almost make sense, but see below...

I wonder whether this issue and the one with StreamPlot I posted about are somehow related. In the StreamPlot case, an Evaluate now needs to be wrapped around the argument to make things work. Did they somehow mess up the attributes of graphics functions in 11.0.1?

More issues:

scalarField = x^2 - y^2 - z; 
vectorField = D[scalarField, {{x, y, z}}]

VectorPlot3D[{{2 x, -2 y, -1}}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
 Axes -> False, BoxRatios -> Automatic, Boxed -> False, 
 VectorStyle -> "Arrow3D", VectorPoints -> 5, 
 VectorColorFunction -> "SunsetColors", 
 VectorScale -> {0.2, Scaled[0.4]}]

This looks the way it is supposed to look like:

enter image description here

Now we're using the variable vectorField:

VectorPlot3D[{vectorField}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
 Axes -> False, BoxRatios -> Automatic, Boxed -> False, 
 VectorStyle -> "Arrow3D", VectorPoints -> 5, 
 VectorColorFunction -> "SunsetColors", 
 VectorScale -> {0.2, Scaled[0.4]}]

and the result looks like this:

enter image description here

so we see flat, 2D arrows. Bug. As in the StreamPlot bug, it turns out that wrapping vectorField in an Evaluate fixes the problem. It really looks like the improper behavior of VectorPlot3D and StreamPlot are related. One has to wonder what else might be affected.

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ O.k., I'm jumping the gun and have added the bugs tag. $\endgroup$ – Pirx Oct 1 '16 at 20:13
  • $\begingroup$ Can you verify the nonsensical plots I have posted? $\endgroup$ – Pirx Oct 1 '16 at 20:17
  • 1
    $\begingroup$ I can confirm the problem on my system (Win 10, x64). However, if I put curly braces around the argument, it works fine. For example, VectorPlot3D[{{x, y, z}}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] $\endgroup$ – david Oct 2 '16 at 0:52
  • 2
    $\begingroup$ Note that second usage in documentation, VectorPlot3D[{Subscript[field, 1],Subscript[field, 2],\[Ellipsis]},{x,Subscript[x, min],Subscript[x, max]},{y,Subscript[y, min],Subscript[y, max]},{z,Subscript[z, min],Subscript[z, max]}], shows multiple vector fields in a List. Evidently, Mathematica now requires that even a single vector field be enclosed in a List, i.e., {{x, y, z}}. This would be consistent with usage in some other functions. However, documentation should be revised to show this. In my view incorrect documentation is a bug. $\endgroup$ – bbgodfrey Oct 2 '16 at 12:48
  • 1
    $\begingroup$ @SimonWoods it has. There is a paclet fix for it. I have to ask what info I can disseminate in how to get the fix. $\endgroup$ – rcollyer Oct 21 '16 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.