![플롯된 방정식은 PGFPlots를 사용하여 x=5에서 중단됩니다.](https://rvso.com/image/476244/%ED%94%8C%EB%A1%AF%EB%90%9C%20%EB%B0%A9%EC%A0%95%EC%8B%9D%EC%9D%80%20PGFPlots%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20x%3D5%EC%97%90%EC%84%9C%20%EC%A4%91%EB%8B%A8%EB%90%A9%EB%8B%88%EB%8B%A4..png)
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}
답변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
.)