0
$\begingroup$

I want to use Manipulate to plot a vector field that is scaled by a parameter. I use

Manipulate[VectorPlot[s {x, y}, {x, -1, 1}, {y, -1, 1}], {s, -1, 1}]

I expect the length of the arrows to change continuously as $|s|$ changes. But instead the arrows always have the same length, independent of $s$. Only their direction changes when $s$ passes through 0.

I don't know if this is a bug or feature and I have to set VectorScale option to some value. I have looked at similar questions but haven't found an answer.

$\endgroup$
3
  • $\begingroup$ Why would they change in a manipulate as s varies if they don't change when plotted individually with differing independent values for s? Table[VectorPlot[s {x, y}, {x, -1, 1}, {y, -1, 1}], {s, -2, 2, .5}] $\endgroup$
    – ktm
    Commented Mar 14, 2017 at 13:44
  • $\begingroup$ I would imagine the arrows don't scale with absolute magnitude, but scale with relative magnitude with one another. s changes the magnitude globally across the plot, so the relative magnitude remains identical. $\endgroup$
    – ktm
    Commented Mar 14, 2017 at 13:46
  • $\begingroup$ @user6014 The problem is that the arrows don't scale correctly, even in a single plot, i.e. VectorPlot[{2 {x, y}, {x , y}}, {x, -1, 1}, {y, -1, 1}, VectorPoints -> 5, VectorStyle -> {Red, Black}] The first vector field is twice as long as the second, so I would expect a plot where the red arrows are twice as long as the black ones. But the plot only shows black arrows, which means that both arrow types are drawn with the same length. When one vector field is larger than the other, they should be displayed like that! $\endgroup$
    – Markus
    Commented Mar 14, 2017 at 17:19

1 Answer 1

1
$\begingroup$

When Mathematica has VectorScale->Automatic as default you scale it in one direction and Mathematica scales it back. Hence, you should work with this option, i.e. set a value.

$\endgroup$

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.