Mathematica has a graphics primitive, Arrow
, that will do what you ask. You may also need the graphics primitive Arrowheads
to adjust the look of the arrowheads if you don't like the default arrowheads.
To demonstrate the use of Arrow
, I will generate a set of tangents to function given by
f[x_] := 4 - x^2
vector[tail : {_, _}, slope_, length_: 1.] :=
Module[{θ = ArcTan[slope]}, {tail, tail + length {Cos[θ], Sin[θ]}}]
tangetVectors = N @ Table[vector[{x, f[x]}, f'[x], .5], {x, Subdivide[-2, 2, 8]}]
{{{-2., 0.}, {-1.87873, 0.485071}},
{{-1.5, 1.75}, {-1.34189, 2.22434}},
{{-1., 3.}, {-0.776393, 3.44721}},
{{-0.5, 3.75}, {-0.146447, 4.10355}},
{{0., 4.}, {0.5, 4.}},
{{0.5, 3.75}, {0.853553, 3.39645}},
{{1., 3.}, {1.22361, 2.55279}},
{{1.5,1.75}, {1.65811, 1.27566}},
{{2., 0.}, {2.12127, -0.485071}}}
Now I will plot the curve 4 - x^2
along with the tangent vectors.
Plot[f[x], {x, -2, 2},
AspectRatio -> 1,
PlotStyle -> {Red, Dotted},
PlotRangePadding -> {{Automatic, .2}, {.5, Automatic}},
Epilog -> {AbsoluteThickness[1.5], Arrow /@ tangetVectors}]
If you don't want to put the vectors on plot, but only want to show the vectors themselves, use Graphics
in place of Plot
Graphics[{AbsoluteThickness[1.75], Arrow /@ tangetVectors}]
ListVectorPlot[]
andListVectorPlot3D[]
? $\endgroup$