# How to draw different vectors in different points in a co-ordination space?

suppose I have four vectors: v1,v2,v3,v4 at the positions (1,1),(1,-1),(-1,1),(-1,-1) respectively in position space in xy plane and the two dimensional components are (0.5,-0.5),(0.75,0.1),(0.4,0.6),(-0.5,-0.5) respectively. somebody please help how to make a vector plot with these information?

## 1 Answer

pos = Tuples[{1, -1}, {2}];
vlst = {{0.5, -0.5}, {0.75, 0.1}, {0.4, 0.6}, {-0.5, -0.5}};
colors = {Red, Green, Blue, Orange};

Graphics[MapThread[{ #, PointSize[Large], Point@#2,
Thick, Arrowheads[Large], Arrow[{#2 , #2 + #3}]} &, {colors, pos, vlst}],
Axes -> True, GridLines -> {{-1, 1}, {-1, 1}}]


Alternatively,

Graphics[MapThread[{ #, PointSize[Large], Point@#2,
Thick, Arrowheads[Large], Translate[ Arrow[{{0, 0}, #3}], #2]} &, {colors, pos, vlst}],
Axes -> True, GridLines -> {{-1, 1}, {-1, 1}}]


same picture

• Thanks. The answer is useful Oct 11 '19 at 7:40
• I have one more query regarding this. Suppose I have thousands of vector defined in thousands points. so it is not possible to define color for individual vectors. Then how to define a color function for the all vectors? Oct 11 '19 at 11:00
• @atanu, you can use colors = ColorData["Rainbow"] /@ Rescale[Range@Length@pos]; or colors = ColorData["Rainbow"] /@ Rescale[Norm /@ (pos + vlst)];  or colors=RandomColor[Length@pos]
– kglr
Oct 11 '19 at 14:54
• thank you. It works fine.. Oct 13 '19 at 11:15