\documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel = $x$, ylabel = $\tanh(x)$, ymin = -1.25,ymax = 1.25, domain = -2:2, smooth,thick, axis lines = center, every tick/.style = {thick}] \addplot[color=blue]{tanh(x)}; \addplot[color=blue,dashed,domain=-1:1,thin]{x}; \end{axis} \end{tikzpicture} \end{document}