tikz에서 좌표를 사용하는 방법은 무엇입니까?

tikz에서 좌표를 사용하는 방법은 무엇입니까?

다음은 내 코드입니다.

\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]



\coordinate (a1) [] {};
\node (rect) (a) [draw,minimum width=3cm,minimum height=1cm, below of=a1,node distance=1cm] {Sender};
\node[rectangle] (b) [draw,minimum width=3cm,minimum height=1cm, below of=a,node distance=2cm] {Receiver};
\coordinate (b1) [below=2cm of b] {};
\path[->] (a) edge node {  $f$ } (b);
\path[->] (a1) edge node {  $f$ } (a);
\path[->] (b) edge node {  $f$ } (b1);
\end{tikzpicture}

다음과 같은 결과가 나타납니다.여기에 이미지 설명을 입력하세요

수신기에서 b1까지 하나의 화살표를 원합니다.

누구든지 내 실수를 말해 줄 수 있습니까?

답변1

coordinate당신은 나쁜 방식으로 정의하고 있습니다 . 다음을 수행해야 합니다.

\coordinate [below=2cm of b] (b1) {};

이렇게 하면 귀하의 코드가 저에게 효과적입니다.

따라서 전체 코드는 다음과 같아야 합니다.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\begin{document}
\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\coordinate (a1) {};
\node (rect) (a) [draw,minimum width=3cm,minimum height=1cm, below of=a1,node distance=1cm] {Sender};
\node[rectangle] (b) [draw,minimum width=3cm,minimum height=1cm, below of=a,node distance=2cm] {Receiver};
\coordinate[below=2cm of b] (b1)  {};
\path[->] (a) edge node {  $f$ } (b);
\path[->] (a1) edge node {  $f$ } (a);
\path[->] (b) edge node {  $f$ } (b1);
\end{tikzpicture}
\end{document}

결과는 다음과 같습니다.

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

관련 정보