2
$\begingroup$

I would like to use VectorPlot3D to plot a vector field with 3D arrows:

B1 = 0.0005;  (*G/μm*)
B2 = -2*B1;
b[x_, y_, z_, Bf_] := {B1*x, B1*y, B2*z + Bf};

VectorPlot3D[b[x, y, z, 0], {x, -13, 13}, {y, -13, 13}, {z, -13, 13}, 
             PlotRange -> {{-13, 13}, {-13, 13}, {-13, 13}}, 
             VectorScale -> {0.1, 1, None}, VectorPoints -> {6, 6, 5}, 
             VectorStyle -> {"Arrow3D", Red}, 
             RegionFunction -> Function[{x, y, z}, x^2 + y^2 + 2 z^2 < 13^2], 
             Boxed -> True, Axes -> False]

Is there a way to change the properties of the 3D arrow tails? For example, to make them thicker.

I'm guessing it has something to do with the Tube[] function, but I cannot quite figure it out.

Thanks in advance!

$\endgroup$

1 Answer 1

6
$\begingroup$

The answer comes directly from the help of VectorPlot3D under Options -> VectorStyle. There, it is shown how you can use customized graphics to tweak the appearance

g = {Graphics3D[Cylinder[{{0, 0, 0}, {1, 0, 0}}, 0.5]], 
   Graphics3D[Cone[{{-0.5, 0, 0}, {1.5, 0, 0}}, 0.5]]};

VectorPlot3D[{y, -x, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
 VectorColorFunction -> Hue, VectorPoints -> 4, VectorStyle -> {g}, 
 VectorScale -> {Automatic, Scaled[0.3]}]

Mathematica graphics

Update

You can always adjust the Tube directives in your final 3d graphics. For this, use a simple replacement, where you fix the tube radius. If gr is your graphics, the general approach looks like this:

gr /. Tube[pts_, r_] :> Tube[pts, r*scale]

To try it, you could include it into a dynamic Manipulate

Manipulate[
 gr = VectorPlot3D[
   b[x, y, z, 0], {x, -13, 13}, {y, -13, 13}, {z, -13, 13}, 
   PlotRange -> {{-13, 13}, {-13, 13}, {-13, 13}}, 
   VectorPoints -> {6, 6, 5}, VectorStyle -> {"Arrow3D", Red}, 
   RegionFunction -> Function[{x, y, z}, x^2 + y^2 + 2 z^2 < 13^2], 
   Boxed -> True, Axes -> False];
 gr /. Tube[pts_, r_] :> Tube[pts, r*scale],
 {{scale, 1}, 0, 2}
]
$\endgroup$
2
  • $\begingroup$ Thanks Halirutan, what worked for me in the end was to not use the cylinder part, and just use a combination of scaling the cylinder and the rest of the vector to get the desired ration between tail and arrow. But it seems that there is no simple and easy way to just change the size of the tail? $\endgroup$ Commented Jul 18, 2013 at 20:02
  • $\begingroup$ @MichaelRay A direct way is to replace the Tube directives. I gave an example in the update part of my answer. I hope this helps. $\endgroup$
    – halirutan
    Commented Jul 18, 2013 at 22:32

Your Answer

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

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