# Draw tangent to point in ListLinePLot

I am using ListLinePlot to draw a number of points to a graph:

ListLinePlot[{{5 10^-3, 0}, {4.65 10^-3, 100}, {4.32 10^-3, 200}, {3.74 10^-3, 400},
{3.23 10^-3, 600}, {2.6 10^-3, 900}, {2.09 10^-3, 1200}, {1.68 10^-3, 1500}}]


How can I also draw the tangent to the line in a point?

You can use Interpolation[] to reckon out tangent lines to your data, as in the following:

data = {{5 10^-3, 0}, {4.65 10^-3, 100}, {4.32 10^-3, 200},
{3.74 10^-3, 400}, {3.23 10^-3, 600}, {2.6 10^-3, 900},
{2.09 10^-3, 1200}, {1.68 10^-3, 1500}};

dint = Interpolation[data];
slope = dint';

With[{x = .003 (* where to draw the tangent *), h = 800 (* length of tangent *)},
y = dint[x]; dir = Normalize[{1, slope[x]}]/2;
ListLinePlot[data, Epilog -> Line[{{x, y} - h dir, {x, y} + h dir}]]] If multiple tangents are desired, here's one way to go about it:

With[{pos = {.002, .003, .0045} (* where to place tangents *),
h = 400 (* length of tangent *)},
ListLinePlot[data, Axes -> None, Epilog ->
Table[With[{y = dint[x], dir = Normalize[{1, slope[x]}]/2},
{AbsoluteThickness, Line[{{x, y} - h dir, {x, y} + h dir}]}],
{x, pos}], Frame -> True, PlotStyle -> AbsoluteThickness]] • If I want multiple tangents, how do I do that? – Tyilo Aug 29 '12 at 9:58
• I've edited my answer. – J. M.'s technical difficulties Aug 29 '12 at 10:08