# How to scale vectors in VectorPlot?

I generated some pics from 2 datum，one in $x$ direction and the other in $y$，so I used the commands:

exfield = Range[200];
polarplane = Range[200];
Get["C:\\Users\\dc\\Desktop\\polarplane.dat"];
Get["C:\\Users\\dc\\Desktop\\exfield.dat"];
xx = Table[
Transpose[{exfield[[25, i]], polarplane[[25, i]]}], {i, 71}];
ListVectorPlot[xx]


to get the vector field. But one problem here is, all the pics generated by the commands share the same maximum length of the vector. I can only see the orientation change but no magnitude change. I need a cartain standard (for instance, 1 cm vector length for the maximum data value $a_{max}$) to generate all the pics, so I can see the relative magnitude change. But I couldn't find the options. Have anyone encountered this same problem? Thank you. And the sample datum are like:

 exfield[[001]] = {
{
a11,
……，
a1i，
},
{
a21,
……，
a2i，
},
……
{
ai1,
……，
aii，
},
}


and the sample data:

data

-
Could you maybe post polarplane.dat and exfield.dat somewhere (e.g. Pastebin)? –  Ｊ. Ｍ. Nov 12 '12 at 11:10
Oh, you finally come! Why not log in？ –  xzczd Nov 13 '12 at 3:56
it's quite a large file, tons of datum, I am trying to find a place to upload the file –  user49114 Nov 13 '12 at 4:04
dropbox.com/s/m3p34ncas3qd8qm/datum.rar here, and, thank you –  user49114 Nov 13 '12 at 4:09
add comment

## migrated from math.stackexchange.comNov 12 '12 at 11:07

This question came from our site for people studying math at any level and professionals in related fields.

## 1 Answer

You can use the VectorScale option for ListVectorPlot to control the scaling of vector sizes.

ListVectorPlot[Table[{y, -x}, {x, -3, 3, 0.2}, {y, -3, 3, 0.2}],
VectorScale -> .05]


ListVectorPlot[Table[{y, -x}, {x, -3, 3, 0.2}, {y, -3, 3, 0.2}],
VectorScale -> .1]


Here is a fleshed out version:

Gather some data:

xxs = Table[Transpose[{exfield[[#, i]], polarplane[[#, i]]}], {i, 71}] & /@Range[27,35];


Find the relevant max vector sizes.

scales = With[{s = Max@Apply[Norm@#&,#,{2}] & /@ xxs}, s/Max@s];


Plot the vector fields, with a couple of fiddle factors for arrowhead size and absolute vector length:

GraphicsGrid[
Partition[
MapThread[
ListVectorPlot[#1, VectorScale -> #2,
VectorStyle -> Arrowheads[#2 0.015]] &, {xxs, 0.3 scales}], 3]]


-
This is a little different from OP's intention: he wants the length of arrows to somewhat represent the size of the vector. –  xzczd Nov 13 '12 at 3:59
sorry I didn't put it clear, what i mean is i wanna use the same standard to present all the vectors in different plots. thank you anyway –  user49114 Nov 13 '12 at 4:10
You can use the VectorScale to adjust the scale to the relative maximum size of the largest vector from each set of data. –  image_doctor Nov 13 '12 at 9:38
Er…we can also use Norm instead of EuclideanDistance, right? –  xzczd Nov 14 '12 at 6:05
@xzczd Yes certainly :) –  image_doctor Nov 14 '12 at 7:49
show 6 more comments