Plot.plot({
ariaLabel: 'The parabola f of w, ' +
'with the tangent line at the chosen w, ' +
'and two points above w plus epsilon: ' +
'one on the tangent line (the prediction) and one on the curve (the exact value), ' +
'joined by a red segment showing the error.',
width: 460, height: 340, grid: true,
x: {domain: [-1.5, 6.5], label: "w"},
y: {domain: [0, 20], label: "f(w)"},
marks: [
Plot.line(d3.range(-1.5, 6.51, 0.05), {x: (w) => w, y: tanF, stroke: "#555", strokeWidth: 2, clip: true}),
Plot.line([-1.5, 6.5], {x: (w) => w, y: (w) => tanF(tanW) + (w - tanW) * tanDf(tanW),
stroke: "#1f77b4", strokeWidth: 2, strokeDasharray: "6,4", clip: true}),
Plot.ruleX([tanW + tanEps], {stroke: "#bbb", strokeDasharray: "2,3"}),
Plot.link([0], {x1: tanW + tanEps, x2: tanW + tanEps, y1: tanPred, y2: tanExact,
stroke: "#d62728", strokeWidth: 3, clip: true}),
Plot.dot([[tanW, tanF(tanW)]], {x: (d) => d[0], y: (d) => d[1], r: 5, fill: "#222"}),
Plot.dot([[tanW + tanEps, tanPred]], {x: (d) => d[0], y: (d) => d[1], r: 4, fill: "#1f77b4", clip: true}),
Plot.dot([[tanW + tanEps, tanExact]], {x: (d) => d[0], y: (d) => d[1], r: 4, fill: "#555", clip: true})
]
})