An example of how to draw line junctions in a block diagram. A semicircle is used to indicate that two lines are not connected. This is a good example of how flexible TikZ' paths are. The intersection between the lines are calculated using the convenient -| syntax. Since we want the semicircle to have its center where the lines intersect, we have to shift the intersection coordinate accordingly.
Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the
LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.
En français: TeXnique.fr.
% Block diagram wire junctions
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\tikzstyle{block} = [draw,fill=blue!20,minimum size=2em]
% diameter of semicircle used to indicate that two lines are not connected
\def\radius{.7mm}
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]
\begin{tikzpicture}[>=latex']
% Draw blocks, inputs and outputs
\foreach \y in {1,2,3,4,5} {
\node at (0,-\y) (input\y) {$i_\y$};
\node[block] at (2,-\y) (block\y) {$f_\y$};
\draw[->] (input\y) -- (block\y);
\draw[->] (block\y.east) -- +(0.5,0);
}
\node[block] at (2,-6) (block6) {$f_6$};
\draw[->] (block6.east) -- +(0.5,0);
% Calculate branch point coordinate
\path (input1) -- coordinate (branch) (block1);
% Define a style for shifting a coordinate upwards
% Note the curly brackets around the coordinate.
\tikzstyle{s}=[shift={(0mm,\radius)}]
% It would be natural to use the yshift or xshift option, but that does
% not seem to work when shifting coordinates.
\draw[->] (branch) node[branch] {}{ % draw branch junction
\foreach \c in {2,3,4,5} {
% Draw semicircle junction to indicate that the lines are
% not connected. The intersection between the lines are
% calculated using the convenient -| syntax. Since we want
% the semicircle to have its center where the lines intersect,
% we have to shift the intersection coordinate using the 's'
% style to account for this.
[shift only] -- ([s]input\c -| branch) arc(90:-90:\radius)
% Note the use of the [shift only] option. It is not necessary,
% but I have used it to ensure that the semicircles have the
% same size regardless of scaling.
}
} |- (block6);
\end{tikzpicture}
\end{document}
Comments
Thanks for sharing this! I'm just writing an article in Latex for control systems and that helped very much.
Adding comments is currently not enabled.