Sometimes it’s not possible in diagrams or charts, that a line goes over another one. To not let this crossing look like a real connection of the two lines, we can let the top line go over a gap in the bottom line. It would require to calculate the intersection of the lines.
However, there’s an easy way: draw the firsts line normally, then draw the top line with a bit whitespace around. Or the top line first thicker and white (or background color), then again thin and black (foreground color).
The probably easiest way in TikZ is: draw a “double” line (TikZ manual, 15.3.4 Graphic Parameters: Double Lines and Bordered Lines). Originally, it gives two parallel lines with space in-between filled by a color. But we want to get a single line. Solution: a double line in white, the gap between them filled in black. This results in a black line with white space around.
Many words, short and simple code example:
1 2 3 4 5 6 7 |
\tikzset{% link/.style = { white, double = black, line width = 1.8pt, double distance = 0.8pt }, channel/.style = { white, double = black, line width = 0.8pt, double distance = 0.6pt }, } |
This way, double distance
is the width of the actual black line, while line width
stands for the white space on each side.
Use it such as:
1 2 3 |
\draw [link, ... ] node1 -- node2; \draw [channel, ... ] node3 -- node4; |
It can look like:
Or: