
答え1
- 定義するには
domain=-5:5
、pgfplots
以下に-4
複雑な関数を描画する必要がありますが、これは不可能です。したがって、下限の定義域は であることが賢明です-4
。 - 関数の接線は
x=-4
直交しているので、デフォルトのサンプル数は関数の変化に追従できるほど小さい。
最も簡単な解決策は
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
ylabel={$y$},
axis lines=center,
%samples=400% for more smuth curve
]
\addplot[domain=-4:5, color=red] {sqrt(x+4)-2};
\end{axis}
\end{tikzpicture}
\end{document}
これにより
答え2
描いているものが反転した放物線であると認識しているだけであれば、大量のサンプルは必要ありません。
\documentclass[margin=3pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
ylabel={$y$},
axis lines=center]
\addplot[domain=-2:1.5, color=red] ({(x+2)^2-4},{x});
\end{axis}
\end{tikzpicture}
\end{document}