# Plotting a vector field

Can I somehow plot a vector field and the scattered data point associated with each and every vector? Also, is there any way to prevent Mathematica from interpolting the vector field?

I am trying to plot this data as a vector field. The data is from a .dat file that includes the following four columns: x-coord, y-coord, vecx, vecy.

I managed to plot the following with Tecplot

I am trying to remake this plot in Mathematica

testBC = Import["C:\\...testBC.dat", "Table", "IgnoreEmptyLines" -> True];
testBCx = testBC[[All, 1]];
testBCy = testBC[[All, 2]];
ux = testBC[[All, 3]];
uy = testBC[[All, 4]];
u = Transpose[{ux, uy}];
testbdry = Transpose[{testBCx, testBCy}];
ListVectorPlot[Transpose[{testbdry, u}], PlotRange -> Full,
VectorPoints -> 10, VectorScale -> {0.1, 0.2}]


Results in the following

Mathematica interpolates the inside of the airfoil.

How can I remake the plot from Tecplot, i.e., how can I show the scatter plot of x, y, and the vectors pointing away from every point. Also, I want Mathematica to plot all the vectors as in Tecplot, not to only sample and interpolate.

-
–  Jens Mar 17 '13 at 19:21

I saved the data on my desktop and imported it. To my surprise ListVectorPlot crashed my kernel.

orgData = Import["C:\\Users\\stelzer\\Desktop\\testBC.txt", "Data"];

Graphics[{Arrowheads[Small], Arrow[{{#1, #2}, {#1, #2} + 0.03 {#3, #4}}] & @@@
orgData}, Frame -> True, FrameLabel -> {"v1", "v2"}]


-

I think you're looking for the option "VectorPoints -> All"; I think this achieves both your goals (one vector per coordinate and no interpolation):

testBC = Import["~/Downloads/testBC.dat", "Table", "IgnoreEmptyLines" -> True];
testBCx = testBC[[All, 1]];
testBCy = testBC[[All, 2]];
ux = testBC[[All, 3]];
uy = testBC[[All, 4]];
u = Transpose[{ux, uy}];
testbdry = Transpose[{testBCx, testBCy}];
ListVectorPlot[Transpose[{testbdry, u}],
PlotRange -> Full,
VectorPoints -> All,
VectorStyle -> Automatic,
AspectRatio -> 1/2,
VectorScale -> {0.1, 0.2}]


Which gives the following result:

Note that I also changed the AspectRatio to approximate your initial plot image above.

-
@ernst-stelzer FYI: ListVectorPlot did not crash my kernel in v9.0.1 (Mac OS X 10.8.2) –  zentient Mar 17 '13 at 12:46