좌표 라벨 추가하기 tikz

좌표 라벨 추가하기 tikz

좌표에 라벨을 붙이고 싶습니다. 예를 들어 좌표점 (1,0) 옆에 "(1,0)"이라는 텍스트를 넣고 싶습니다. 노드 문서를 살펴봤습니다. 더 좋은 방법이 있습니까? 참고로 제가 그린 그림은 이렇습니다.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz} 
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (8,8);
\draw (0,0) -- (8,8);
\draw (0,2) -- (6,8); % line from (0,1/4) to (3/4,1)
\draw[->] (0,0) -- (8.5,0) node[anchor=north west] {$v_1$};
\draw[->] (0,0) -- (0,8.5) node[anchor=south east] {$v_2$};
\fill[black!40!white] (0,2) -- (6,8) -- (0,8) -- cycle;
\addplot[mark=*] coordinates {(0,1)} node:{$(0,1)$}{}; 

\end{tikzpicture}
\end{document}

답변1

내가 당신을 올바르게 이해했다면 다음과 같은 것을 찾는 것보다 :

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

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (8,8);
\draw (0,0) -- (8,8);
\draw (0,2) -- (6,8); % line from (0,1/4) to (3/4,1)
\draw[->] (0,0) -- (8.5,0) node[anchor=north west] {$v_1$};
\draw[->] (0,0) -- (0,8.5) node[anchor=south east] {$v_2$};
\fill[black!40!white] (0,2) -- (6,8) -- (0,8) -- cycle;
\node[circle,inner sep=1pt,fill=red,label=left:{$(0,1)$}] at (0,1) {};% this replace your `addplot`
\end{tikzpicture}
\end{document}

참고: 매크로 addplot이며 축 환경에 포함하지 않는 한 pgfplots에서 사용할 수 없습니다 (MWE를 컴파일할 수 없음).tikzpicture

다른 좌표에 라벨을 붙이고 싶다면 가능한 해결책은 다음과 같습니다.

\coordinate[label=left:{(0,2)}] (A) at (0,2);
\coordinate[label=above:{(6,8)}] (B) at (6,8);
\draw[fill=black!40!white] (A) -- (B) -| (A);

다음을 대체할 수 있습니다.

\draw (0,2) -- (6,8); % line from (0,1/4) to (3/4,1)
\fill[black!40!white] (0,2) -- (6,8) -- (0,8) -- cycle;

귀하의 MWE에서. 또 다른 대안은 예를 들어 다음과 같습니다.

\draw (0,2) node[left] {(0,1)} -- (6,8) node[above] {(6,8)}; % line from (0,1/4) to (3/4,1)

등.

관련 정보