\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{pgfplots}
\usepackage{xcolor}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
xlabel={x},
ylabel={y},
xmin=0, xmax=5,
ymin=0, ymax=8,
xtick={0,1,2,3,4,5},
ytick={0,2,4,6,8,10},
]
\addplot[
only marks,
color=blue,
mark=square
]
coordinates {
(1,2) (2,4) (3,4) (4,6)
};
\addplot[no marks,blue] expression[domain=1:4,samples=50]{1.6*x};
\end{axis}
\draw [decorate,decoration={brace,amplitude=2pt,mirror}, yshift = -0.2cm]
(2,4) -- (2,3.2) node (curly_bracket)[black,midway, yshift =- 0.3 cm]
{};
\end{tikzpicture}
\end{center}
\end{document}
점 (2,4)와 (2,3.2) 사이에 버팀대를 그리려고 하는데 코드를 사용하여 올바른 위치에 버팀대를 그릴 수 없습니다.
\draw [decorate,decoration={brace,amplitude=2pt,mirror}, yshift = -0.2cm]
(2,4) -- (2,3.2) node (curly_bracket)[black,midway, yshift =- 0.3 cm]
{};
. x=2일 때 중괄호는 선의 편향을 가리키는 것으로 이해할 수 있습니다. 어떤 도움이라도 대단히 감사하겠습니다!
감사해요!
답변1
이 시도.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{pgfplots}
\usepackage{xcolor}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
xlabel={x},
ylabel={y},
xmin=0, xmax=5,
ymin=0, ymax=8,
xtick={0,1,2,3,4,5},
ytick={0,2,4,6,8,10},
]
\addplot[
only marks,
color=blue,
mark=square
]
coordinates {
(1,2) (2,4) (3,4) (4,6)
};
\addplot[no marks,blue] expression[domain=1:4,samples=50]{1.6*x};
\draw [decorate,decoration={brace,amplitude=2pt,mirror}, yshift = -0.2cm]
(axis cs:2,4) -- (axis cs:2,3.2) node (curly_bracket)[black,midway, yshift =- 0.3 cm]
{};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}