pgfplots의 제곱근이 표시되지 않음

pgfplots의 제곱근이 표시되지 않음

이미 몇 가지 함수를 플롯하는 데 사용한 다음 코드 비트를 실행 중입니다. 그러나 다음 함수로 실행하면 축만 플롯됩니다.

\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}

여기에 이미지 설명을 입력하세요

관련 정보