Follow up question see pgfplots: x vs \x.
I have a rather straightforward pgfplots
diagram but I do not understand why there is a bump in my tanh
function (should be smooth). The domain
(and samples
) key seems to influence the outcome. Can you explain this behavior and is there a systematic logic to prevent that (or do I need to use a trial-and-error approach)?
\documentclass[tikz,border=1mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest} % Updated after comments, was 1.15 before.
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width = 160mm,
height = 90mm,
axis lines = center,
xmin = -10,
xmax = 10,
ymin = -1,
ymax = 1,
enlarge x limits = 0.05,
enlarge y limits = 0.10,
]
\addplot[
color = blue,
mark = none,
smooth,
line width = 1pt,
domain = -30:30, % When changed to -10:10 then the bump is not visible.
samples = 200,
] {tanh(1*\x)};
%
\end{axis}
\end{tikzpicture}
\end{document}
tanh(6.656) = 1Y1.2e0]
.