# Combining VectorPlot and Graphics3D

I have a simple VectorPlot3D

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]


Can I substitute the default arrows with Graphics3D object like:

Graphics3D[Ellipsoid[{0, 0, 0}, {6, 2, 2}]]


?

• Have you tried VectorMarkers? You might be able to find a satisfactory built-in. Commented Nov 29, 2021 at 13:14
• DId you instead want to use VectorPlot3D ?
– Syed
Commented Nov 29, 2021 at 13:19
• @MarcoB yes, however none of the default options met my expectations Commented Nov 29, 2021 at 14:40
• @Syed - the solution I am looking for it is whether there is a possibility to substitute the default markers with, for example, ellipsoid. Commented Nov 29, 2021 at 14:44
• @ATomek The replacement process is easy: VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. Arrow[a_] :> yourNewGraphic[a]. For instance, try Line[a] in that code. However, the problem with Ellipsoid is that it does not use coordinates the same way that Arrow does, so you will have to do some math to determine the appropriate parameters. Commented Nov 29, 2021 at 23:30

## 1 Answer

You can use the option VectorStyle as follows:

VectorPlot3D[{z, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
VectorColorFunction -> Hue,
VectorPoints -> 3,
VectorStyle -> Graphics3D[Ellipsoid[{0, 0, 0}, {6, 2, 2}]],
VectorScale -> {Automatic, Scaled[0.05]},
ViewPoint -> {1.5, -2., 2.5}]


We can also use VectorStyle -> {{None, Graphics3D[Ellipsoid[{0, 0, 0}, {6, 2, 2}]]}} to get the same picture. Using this form allows to assign different Graphics3D objects to the two ends of the arrows. For example,

VectorPlot3D[{z, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
VectorColorFunction -> Hue,
VectorPoints -> 3,
VectorStyle ->
{{Graphics3D[Cuboid[-{1.5, 1.5, 1.5}, {1.5, 1.5, 1.5}]],
Graphics3D[Ellipsoid[{0, 0, 0}, {6, 2, 2}]]}},
VectorScale -> {Automatic, Scaled[0.05]},
ViewPoint -> {1.5, -2., 2.5}]


We can override the automatic styling of arrowheads using desired directives inside Graphics3D (e.g., Graphics3D[{desiredStyle, desired3Dprimitive}]). For example, using

VectorStyle -> {{Graphics3D[{Green, Cuboid[-{1.5, 1.5, 1.5}, {1.5, 1.5, 1.5}]}],
Graphics3D[Ellipsoid[{0, 0, 0}, {6, 2, 2}]]}}


gives

• this works in version 11.3.0.
– kglr
Commented Nov 30, 2021 at 8:03