# Trigonometric function plot

Good morning, I have a problem using pgfplots. I tried to draw the function y=arctan(1/x), but I obtain an inexact result. Where is the problem? The code is:

\documentclass{article}
\usepackage{pgfplots,relsize}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
width=12cm,height=6cm,
axis lines=middle,
enlargelimits,
xtick={-5,5},ytick={-1.57,1.57},
xticklabels={$-5$, $5$},
yticklabels={$-\pi/2$, $\pi/2$},
xlabel=$x$,ylabel=$y$]
samples=200,smooth,thick,blue]
\end{axis}
\end{tikzpicture}
\end{document}

• What is your exact problem? Show a picture of what you expect and a picture of what you get. – pschulz Feb 25 '17 at 10:24
• Sometimes the problem with trigonometric functions is that rad instated of degree (or vice versa) are used. Have you made sure that this is not the case? See also tex.stackexchange.com/questions/12951 \begin{axis}[trig format plots=rad] – Dr. Manuel Kuehner Feb 25 '17 at 10:30

I hope it is what you wanted.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis} [
width=12cm,
height=6cm,
axis lines=middle,
enlargelimits,
xtick={-5,5},
ytick={-1.57,1.57},
xticklabels={$-5$, $5$},
yticklabels={$-\pi/2$, $\pi/2$},
xlabel=$x$,
ylabel=$y$
]
mark=none,
domain=-10:0,
samples=200,
smooth,
thick
mark=none,
domain=0:10,
samples=200,
smooth,
thick,