私はすでにいくつかの関数をプロットするために使用した次のコードを実行していますが、次の関数で実行すると、軸のみがプロットされます。
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns,positioning,calc}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}
\begin{axis}[
y=1cm,
x=1cm,
axis x line=center,
axis y line=center,
xtick={-1,0,...,12},
ytick={-1,0,...,5},
xlabel={$X$},
ylabel={$Y$},
xlabel style={below right},
ylabel style={above left},
xmin=-1,
xmax=12.5,
ymin=-1,
ymax=5.5]
\addplot+[color=black,smooth] {sqrt(x-6)};
\end{axis}
\end{tikzpicture}
\caption{The graph of $f(x) = \sqrt{x-6}$}
\end{center}
\end{figure}
答え1
ようこそ!負の数の平方根を計算しない限り、すべて問題ありません。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
y=1cm,
x=1cm,
axis x line=center,
axis y line=center,
xtick={-1,0,...,12},
ytick={-1,0,...,5},
xlabel={$X$},
ylabel={$Y$},
xlabel style={below right},
ylabel style={above left},
xmin=-1,
xmax=12.5,
ymin=-1,
ymax=5.5]
\addplot+[color=black,smooth,domain=6:12.5] {sqrt(x-6)};
\end{axis}
\end{tikzpicture}
\end{document}