Is there a way to control the line endings of a line/curve to be vertical. It is easier to explain with a picture. Here I have drawn a curve, but as you can see the lines end at the angle equal to the gradient of the curve at that point. I want it to end vertically so that it looks like the line is truncated where the axes end:
\begin{tikzpicture}[scale=1]
\draw[line width=20pt, red] plot [smooth,tension=1] coordinates{(-1,0.5) (0,1.5) (1,1.5) (2,2.4) (3,2) (4,2.2)};
\draw[thick] plot [smooth,tension=1] coordinates{(-1,0.5) (0,1.5) (1,1.5) (2,2.4) (3,2) (4,2.2)};
\draw [->, black, ultra thick] (-1,0) -- (4,0);
\draw [->, black, ultra thick] (0,-1) -- (0,4);
\end{tikzpicture}
Here's the code