
I와 C 노드(I|-C)의 교차점에 노드를 배치하려면 어떻게 해야 합니까? MWE:
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}
\usetikzlibrary{arrows,chains,positioning,shapes,scopes}
\begin{document}
\begin{tikzpicture}
[>=latex,node distance=.8cm,
start chain =going below,]
\tikzset{base/.style = {
draw,rounded corners,minimum width=20mm, minimum height=6mm, align=center,
inner sep=1mm, outer sep=0mm,
on chain, join=by {->}}}
\tikzset{start/.style={base,minimum size=6mm,circle,fill=black}}
\tikzset{end/.style={base,circle}}
\tikzset{box/.style={base}}
\tikzset{decision/.style={base,rounded corners=0,minimum size=6mm,diamond,aspect=1.5,on chain}}
{
\node[start] (A) {};
\node[box] (B) {clone repository};
\node[box] (C) {coding};
\node[box] (D) {commit locally};
\node[box] (E) {review};
\node[decision] (F) {};
{[start branch]
\node[box,left=2cm of F] (G) {rework};
\node[box,on chain=going above] (H) {recommit};
}
{[start branch]
\node[box,right=2cm of F] (I) {submit};
\coordinate (O) at (I |- C);
\node[box] at (O) (J) {update local repository};
}
\draw[->] (H) -- (E);
\draw[->] (J) -- (C);
% debug code line
\draw[red] (O) -- (I) (O) -- (C);
}
\end{tikzpicture}
\end{document}
답변1
노드 배치의 불일치는 노드 의 속성 J
으로 인해 발생합니다 . 이 속성을 취소하면 노드는 원하는 위치에 있게 됩니다.on chain
box
잘 모르기 때문에 체인의 특정 노드에 대해 이것이 가능하다면 tikzset
해당 옵션을 다시 구성하여 나중에 다른 노드 스타일의 스타일 정의에 사용되는 on chain
제거 base
및 추가 옵션을 사용합니다.box
이 변경 사항과 연결 라인의 일부 변경 사항(MWE에서 비논리적임)을 통해 다음 이미지를 얻습니다.
그것이 당신이 찾고 있는 것인가요?
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{chains, shapes}
\begin{document}
\begin{tikzpicture}[>=latex,
node distance = 8mm,
start chain = going below,
base/.style = {draw, rounded corners,
minimum width=20mm, minimum height=6mm,
align=center,
inner sep=1mm, outer sep=0mm,
},
box/.style = {base, on chain, join=by {->}},
start/.style = {box,minimum size=6mm,circle,fill=black},
end/.style = {box,circle, on chain},
decision/.style = {box, diamond, aspect=1.5,
sharp corners, minimum size=6mm}
]
\node[start] (A) {};
\node[box] (B) {clone repository};
\node[box] (C) {coding};
\node[box] (D) {commit locally};
\node[box] (E) {review};
\node[decision] (F) {};
{%[start branch]
\node[box,left=2cm of F] (G) {rework};
\node[box,on chain=going above] (H) {recommit};
}
{%[start branch]
\node[base,
right=2cm of F] (I) {submit};
\node[base] (J) at (I |- C) {update local repository};
}
\draw[->] (H) -- (E);
\draw[->] (F) -- (I);
% debug code line
\draw[red,->] (I) edge (J) (J) to (C);
\end{tikzpicture}
\end{document}