# VectorScaling on VectorPlot produces vectors of wrong length

I'm trying to plot the following VectorField:

VectorPlot[{x/Sqrt[x^2 + y^2], y/Sqrt[x^2 + y^2]}, {x, -5, 5}, {y, -5, 5}]


I want to use a VectorScaling-option such that vectors are displayed accoring to their length. Obviously, all vectors in this specific vector plot should have the same length, as they are normalized. I tried to achieve this using the options

VectorScaling->Automatic


This yields the following output:

The vectors have different lengths (and the colors match this). Why does this happen? The options "Linear", "Log" and "Sqrt" yield similar results. Is this an artifact of calculation inaccuracies? If so, how may I compensate for this?
If I don't use any VectorScaling-option, then all the vectors have the same length (which is the default), but the colors still vary.
I'm using Wolfram Mathematica 12.3.

Addendum: I understand that getting rid of "VectorScaling->Automatic" would yield vectors of constant length. Though I'd like to plot three different vector fields in such a way, that the length of the plottet vectors relates to the real length. So I need some sort of vector scaling for this field of constant length, too.

• Related: mathematica.stackexchange.com/q/239039/4999. This has some discussions of the older VectorScale option that might be helpful: mathematica.stackexchange.com/q/71787/4999 Jun 25, 2021 at 14:08
• Yeah, at the end I just downloaded Mathematica 11 which did the job. Don't know how to achieve what I wanted in 12.3. VectorScaling->Automatic does not do the job if you want other vectorplots with the same scaling to compare them. @MichaelE2 Jun 25, 2021 at 15:25
• Your vectors aren't all the same length. :-) They vary from 0.9999999999999998 to 1.0000000000000002 in length. Floating point math is fun. Jun 25, 2021 at 15:53
• Yes, that's what I guessed, too. Can I explicitley tell Mathematica how to map vector length to arrow length? Jun 25, 2021 at 16:20

f1[x_, y_] := x/Sqrt[x^2 + y^2];
f2[x_, y_] := y/Sqrt[x^2 + y^2];

p1 = VectorPlot[{f1[x, y], f2[x, y]}, {x, -5, 5}, {y, -5, 5},
VectorScale -> {Automatic, Automatic, #1 &}, ImageSize -> Medium]


p2 = VectorPlot[{f1[x, y], f2[x, y]}, {x, -5, 5}, {y, -5, 5},
VectorScale -> {Automatic, Automatic, #2 &}, ImageSize -> Medium]


Finally

Show[p1, p2]


• @ Babelfish i hope this solve it ! May 26, 2021 at 13:08
• Ahem, I think I did not formulate my problem explicitly enough. Your plot shows vectors of different length - but they should all have the same length. Though I don't really understand whats going on, anyway. May 26, 2021 at 13:34