4
$\begingroup$

There must be a simple way to do this, but maybe I'm just dense at this point, I can't seem to achieve it: For a manipulate environment, I need to generate VectorPlots that have a fixed scaling of the vector sizes, so that a vector of length 1, say, always appears at the same size independently of the size of other vectors.

I have a function that, in principle, looks like so:

vp[t_] := 
 VectorPlot[{1, x t}, {x, 0, 1.7}, {y, 0, 1.7}, 
  VectorScale -> {0.03, Automatic, Automatic}]

Thus, the vectors at the left edge (x=0) all have length 1. I want these vectors to appear at the same size no matter what the value of t is.

Right now I get:

enter image description here

enter image description here

so the vectors are rescaled so that their maximum size stays the same. I found a discussion of what seems like a similar request here, but I'm not entirely sure the question is really the same; in any case, I find it hard to believe there's no simple way to do this. Is there really no simple VectorScale directive that does something as straightforward as this, namely saying "a vector of norm nv will be plotted at length of d nv", where d is a length given in terms of plotting units"?

$\endgroup$
3
$\begingroup$

You may make your vector length a function of x using the explict scale form VectorScale.

With VectorScale -> {0.03, Automatic, 1 + #1 &} then

Table[VectorPlot[{1, x t}, {x, 0, 1.7}, {y, 0, 1.7}, 
  VectorScale -> {0.03, Automatic, 1 + #1 &}], {t, {1, 100}}]

Mathematica graphics

The size can be adjusted by increasing the unit length (e.i. increasing 0.03).

Hope this helps.

$\endgroup$
  • $\begingroup$ Why is it 1+#1? Shouldn't this read Sqrt[1+#1], or Norm[{1, #1}]? Remember, I still want the length of the vectors proportional to the magnitude of {1, x t}. $\endgroup$ – Pirx Sep 20 '16 at 10:58
  • $\begingroup$ @Pirx Those scale functions will work as well. The object is to have a function of x independent of t such that the lengths remain constant for each value of x as t varies. The scale function does not have to be a vector measure. $\endgroup$ – Edmund Sep 20 '16 at 11:03
  • $\begingroup$ O.k., I think I have it now. Thanks! $\endgroup$ – Pirx Sep 20 '16 at 11:04

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.