플롯된 방정식은 PGFPlots를 사용하여 x=5에서 중단됩니다.

플롯된 방정식은 PGFPlots를 사용하여 x=5에서 중단됩니다.

PGFPlots를 사용하여 두 개의 방정식을 플롯하려고 합니다. 그들은 -(x-7)^2+12과 입니다 (x-6)^2-2. 그러나 결과 그래프는 x=5 이상으로 그려지지 않습니다. 플롯을 구성하는 데 사용하는 코드를 살펴봤지만 문제를 일으키는 것은 아무것도 없는 것 같습니다.

최소 작업 예:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        axis lines = middle,
        xmin = 0, xmax = 10,
        xtick = {0,2,...,10},
        extra y ticks = 0,
        ymin = -5, ymax = 15,
        ytick = {-5,0,...,15},
        samples = 100,
    ]
        \addplot[color=red]{-(x-7)^2+12};
        \addplot[color=blue]{(x-6)^2-2};
    \end{axis}
\end{tikzpicture}

\end{document}

결과 그래프의 스크린샷. 두 가지 함수를 사용하여 PGFPlots로 플롯한 그래프, 둘 다 x=5에서 중지됨

답변1

PGFP롯domain={-5:5}기본값당 세트이는 플롯을 -5 ≤로 제한합니다.엑스≤ 5. 하지만 이를 쉽게 변경할 수 있습니다.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        axis lines = middle,
        xmin = 0, xmax = 10,
        xtick = {0,2,...,10},
        extra y ticks = 0,
        ymin = -5, ymax = 15,
        ytick = {-5,0,...,15},
        samples = 100,
        domain = {0:10}
    ]
        \addplot[color=red]{-(x-7)^2+12};
        \addplot[color=blue]{(x-6)^2-2};
    \end{axis}
\end{tikzpicture}

\end{document}

(이 옵션을 명령과 함께 사용할 수도 있습니다 \addplot.)

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

관련 정보