1

I am trying to draw straight vertical lines between rectangles without using absolute coordinates.

Example (red lines) enter image description here

Code example:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc, chains, intersections, positioning}

\begin{document}
\begin{figure}[!htbp]
\centering
\begin{tikzpicture}[thick]

\node[
    draw, rectangle, thick, 
    minimum width=8cm, 
    minimum height=1cm, 
    align=center
] (rectangle3) at (0,0) {Rectangle 3};

\node[
    draw, rectangle, thick,
    minimum width=3cm,
    minimum height=3cm, 
    align=center,
    above=of rectangle3.west,
    anchor=west,
    yshift=20mm
] (rectangle1)  {Rectangle 1};

\node[
    draw, rectangle, thick,
    minimum width=3cm,
    minimum height=3cm, 
    align=center,
    above=of rectangle3.east,
    anchor=east,
    yshift=20mm
] (rectangle2) {Rectangle 2};

\end{tikzpicture}
\end{figure}
\end{document}

0 Answers0