3
$\begingroup$

My thinking was that Arrowheads[0] would turn off the arrowheads.

vf = VectorPlot[{1, p*Exp[-p]}, {t, 0, 5}, {p, 0, 3},
  VectorScale -> {0.05, Automatic, None}, VectorPoints -> 20,
  VectorStyle -> {Gray, Arrowheads[0]}, AspectRatio -> Automatic]

Which gives the following image.

enter image description here

Is my thinking incorrect?

Absolutely weird, look what happens when I reverse the order of Gray and Arrowheads[0], changing no other code.

vf = VectorPlot[{1, p*Exp[-p]}, {t, 0, 5}, {p, 0, 3},
  VectorScale -> {0.05, Automatic, None}, VectorPoints -> 20,
  VectorStyle -> {Arrowheads[0], Gray}, AspectRatio -> Automatic]

enter image description here

Is this a bug?

Running Version 10.0.1.0.

$\endgroup$
6
$\begingroup$

A list of styles is the syntax for giving a series of styles to be applied cyclically to each of a series of plot elements. For example:

VectorPlot[{{y, -x}, {x, y}}, {x, -3, 3}, {y, -3, 3}, 
 VectorStyle -> {Gray, Arrowheads[0]}]

enter image description here

Observe that one field gets Gray while the other gets Arrowheads[0]. The correct syntax should be to use a sub-list (as Lou showed) or Directive, and here it works:

VectorPlot[{{y, -x}, {x, y}}, {x, -3, 3}, {y, -3, 3}, 
 VectorStyle -> {{Gray, Arrowheads[0]}, Red}]

enter image description here

Observe that this time one field gets both Gray and Arrowheads[0] while the other gets Red.

However I think there may be a bug in that order matters where I cannot see why it should. This does not work the same as the plot above:

VectorPlot[{{y, -x}, {x, y}}, {x, -3, 3}, {y, -3, 3}, 
 VectorStyle -> {{Arrowheads[0], Gray}, Red}]

enter image description here

Edit: In version 10.1.0 under Windows the output of this last command is the same as that of the penultimate one, so it looks like it was a bug and has since been fixed.

$\endgroup$
  • $\begingroup$ Directive in VectorStyle doesn't work with Arrowheads though. Mathematica 10.0.2 for Mac here. $\endgroup$ – Taiki Apr 27 '15 at 21:11
3
$\begingroup$

Set the style for vector fields:

vf = VectorPlot[{1, p*Exp[-p]}, {t, 0, 5}, {p, 0, 3}, 
  VectorScale -> {0.05, Automatic, None}, VectorPoints -> 20, 
  VectorStyle -> {{Red, Arrowheads[0]}}, AspectRatio -> Automatic]

enter image description here

$\endgroup$

Your Answer

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

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