2
$\begingroup$

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}]]

?

$\endgroup$
5
  • $\begingroup$ Have you tried VectorMarkers? You might be able to find a satisfactory built-in. $\endgroup$
    – MarcoB
    Nov 29, 2021 at 13:14
  • $\begingroup$ DId you instead want to use VectorPlot3D ? $\endgroup$
    – Syed
    Nov 29, 2021 at 13:19
  • 1
    $\begingroup$ @MarcoB yes, however none of the default options met my expectations $\endgroup$
    – ATomek
    Nov 29, 2021 at 14:40
  • $\begingroup$ @Syed - the solution I am looking for it is whether there is a possibility to substitute the default markers with, for example, ellipsoid. $\endgroup$
    – ATomek
    Nov 29, 2021 at 14:44
  • $\begingroup$ @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. $\endgroup$
    – MarcoB
    Nov 29, 2021 at 23:30

1 Answer 1

1
$\begingroup$

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}]

enter image description here

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}]

enter image description here

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

enter image description here

$\endgroup$
1
  • $\begingroup$ this works in version 11.3.0. $\endgroup$
    – kglr
    Nov 30, 2021 at 8:03

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.