How do I plot the graph of arctan using Tikz, NOT using pgfplots [duplicate]

This question already has an answer here:

I am trying to plot the atan() function, but it keeps giving me an error. This is my code. What in the world am I doing wrong? Why doesn't it plot on the graph I made. Also I cannot use pgfplots.

\begin{tikzpicture}
\draw [help lines] (-5,-pi) grid (5,pi);
\draw [->,thick] (-5,0) -- (0,0) -- (5,0) node [below] {\small $x$};
\draw [->,thick] (0,-pi) -- (0,pi) node [left] {\small $y$};
\foreach \x in {-5,-4,...,5} \draw (\x, -0.1) -- (\x,0.1);
\foreach \x in {-5,-4,...,-1} \node at (\x, -0.1) [below] {\tiny $\x$};
\foreach \x in {1,2,...,5} \node at (\x, -0.1) [below] {\tiny $\x$};

\draw (-0.1, -pi/2) -- (0.1,-pi/2);
\draw (-0.1, -pi/4) -- (0.1,-pi/4);
\draw (-0.1, pi/4) -- (0.1,pi/4);
\draw (-0.1, pi/2) -- (0.1,pi/2);

\node at (-0.1, -pi/2) [left] {\tiny $-\pi/2$};
\node at (-0.1, -pi/4) [left] {\tiny $-\pi/4$};
\node at (-0.1, pi/4) [left] {\tiny $\pi/4$};
\node at (-0.1, pi/2) [left] {\tiny $\pi/2$};

\draw [scale=0.5,domain=0:5,variable=\x] plot (\x,atan(\x r));

\end{tikzpicture}