Ubuntu HowTo: Arrows in Block Diagram are not alligned

Original Source Link

Good evening,
i am trying to create a nice plot. Everything works fine so far, but i can not align the arrow from Node “specific” and “theoretical” to Node “cool”.

Thanks for every idea.
Phil

  documentclass[tikz, border=5mm]{standalone}   
    usetikzlibrary{positioning, fit, calc}   
    tikzset{block/.style={draw, thick, text width=2cm ,minimum height=1.7cm, align=center},   
    line/.style={-latex}     
    }  
begin{document}  

begin{tikzpicture}


    node[block,text width=12em,] (top) {Top}; 

    node[block,left of=top, below of=top,minimum height=5em,  node distance=2.5cm] (a) {sub a };   

    node[block,right of=top, below of=top, minimum height=5em, node distance=2.5cm] (b) {sub b };    

    node[block,left of=a, below of=a,minimum height=5em,  node distance=2.5cm] (b1) {General};   

    node[block,right of=b1,minimum height=5em,   node distance=2.5cm] (b2) {Specific }; 

    node[block,right of=b2,minimum height=5em,   node distance=2.5cm] (b3) {theoretical}; 

    node[block,right of=b3, minimum height=5em,  node distance=2.5cm] (b4) {More}; 

    node[block,right of=b4,minimum height=5em,   node distance=2.5cm] (b5) {no more}; 

    node[block,left of=b1, below of=b1, node distance=3cm,minimum height=7em] (c) {Addition};    

    node[block,right of=c, minimum height=7
         em, node distance=3cm] (c1) {Substraction}; 

    node[block,right of=c1,   node distance=3cm,minimum height=7
         em,text width=8em,,fill={rgb:black,1;white,8}] (c2) {Cool}; 

    node[block,below of=b4,   node distance=3cm,minimum height=7
         em,text width=8em, fill={rgb:black,1;white,8}] (c3) {warm};  

         node[block,below of=b5,   node distance=3cm,minimum height=7
         em,text width=4em,fill={rgb:black,1;white,8}] (c4) {cold)};  

 draw[line] (top.south)-- ++(0, -0.25) -|(a.north);     
 draw[line] (top.south)-- ++(0, -0.25) -|(b.north); 
 draw[line] (a.south)-- ++(0, -0.25) -|(b1.north); 
 draw[line] (a.south)-- ++(0, -0.25) -|(b2.north); 
 draw[line] (b.south)-- ++(0, -0.25) -|(b3.north); 
 draw[line] (b.south)-- ++(0, -0.5) -|(b4.north);
 draw[line] (b.south)-- ++(0, -0.25) -|(b5.north);
 draw[line] (b1.south)-- ++(0, -0.4) -|(c.north);
 draw[line] (b1.south)-- ++(0, -0.4) -|(c1.north);
 draw[line] (b2.south)--  ++(0, -0.4) -|(c2.north);
 draw[line] (b3.south)-- ++(0, -0.5) -|(c2.north);
 draw[line] (b4.south)-- ++(0, -0.4) -|(c3.north);
 draw[line] (b5.south)-- ++(0, -0.5) -|(c4.north);

end{tikzpicture}  

end{document}

screenshot of output

These are mainly off-topic comments. You are loading but not using positioning, which has the syntax below=<distance> of ... instead of below of=.... Then I’d rather use matrices for the layout. The only on-topic suggestion here is to use something like

south fork/.style={to path={(tikztostart.south) --
 ++(0,-0.5) -| (tikztotarget)}}

for the paths you are wondering about.

documentclass[tikz,border=5mm]{standalone}   
usetikzlibrary{arrows.meta,positioning,matrix}   
tikzset{block/.style={draw, thick, minimum width=6.5em ,
minimum height=1.7cm, align=center,text depth=0.25ex,text height=0.8em},   
  line/.style={-Latex}     
}  
begin{document}  

begin{tikzpicture}[font=sffamily,
    south fork/.style={to path={(tikztostart.south) --
 ++(0,-0.5) -| (tikztotarget)}},
    mmat/.style={matrix of nodes,column sep=1em,nodes={block,anchor=center,#1}}]
 node[mmat={minimum height=7em}] (row4) 
 {Addition & Subtraction & |[fill=black!20,minimum width=9em]|Cool & 
 |[fill=black!20,minimum width=9em]|Warm & |[fill=black!20]|Cold\};
 node[above=of row4,mmat={minimum height=5em}] (row3) 
 {General & Specific & Theoretical & More & No More\};
 path (row3-1-1.north) -- (row3-1-2.north) node[midway,above=1cm,block,minimum height=5em]
  (row2-1-1) {sub a};
 path (row3-1-3.north) -- (row3-1-5.north) node[midway,above=1cm,block,minimum height=5em]
  (row2-1-2) {sub b};
 path (row2-1-1.north) -- (row2-1-2.north) node[midway,above=1cm,block,text width=12em] 
    (top) {Top};
 path[semithick,line,every edge/.append style={south fork}] 
 (top) foreach X in {1,2} {edge (row2-1-X)}
 (row2-1-1) foreach X in {1,2} {edge (row3-1-X)}
 (row2-1-2) foreach X in {3,4,5} {edge (row3-1-X)}
 (row3-1-1) foreach X in {1,2} {edge (row4-1-X)}
 (row3-1-2) edge (row4-1-3)
 foreach X in {3,4,5} {(row3-1-X) edge (row4-1-X)};
end{tikzpicture}
end{document}  

enter image description here

But forest might be even simpler.

documentclass[border=5mm]{standalone}   
usepackage[edges]{forest}
begin{document}
begin{forest}
block/.style={draw, thick, minimum width=6.5em ,
minimum height=1.7cm, align=center,text depth=0.25ex,text height=0.8em},
forked edges,
for tree={block,edge={-latex,semithick},l sep+=1em,fork sep=1em,
    where level=3{minimum height=7em}{}}
[top
 [sub a
  [General
   [Addition]
   [Subtraction]
  ]
  [Specific,alias=specific
  ]
 ]
 [sub b
  [Theoretical
   [Cool,fill=black!20,minimum width=9em,alias=cool]
  ]
  [More
   [Warm,fill=black!20,minimum width=9em]
  ]
  [No more
   [Cold,fill=black!20,minimum width=9em]
  ]
 ]
]
draw[-latex,semithick] (specific.south) -- ++ (0,-1em) -| (cool.north);
end{forest}
end{document}

enter image description here

Your diagram is correct, I think you just made a mistake on a numerical value, a 0.5 instead of a 0.4

 documentclass[tikz, border=5mm]{standalone}   
    usetikzlibrary{positioning, fit, calc}   
    tikzset{block/.style={draw, thick, text width=2cm ,minimum height=1.7cm, align=center},   
    line/.style={-latex}     
    }  
begin{document}  

begin{tikzpicture}


    node[block,text width=12em,] (top) {Top}; 

    node[block,left of=top, below of=top,minimum height=5em,  node distance=2.5cm] (a) {sub a };   

    node[block,right of=top, below of=top, minimum height=5em, node distance=2.5cm] (b) {sub b };    

    node[block,left of=a, below of=a,minimum height=5em,  node distance=2.5cm] (b1) {General};   

    node[block,right of=b1,minimum height=5em,   node distance=2.5cm] (b2) {Specific }; 

    node[block,right of=b2,minimum height=5em,   node distance=2.5cm] (b3) {theoretical}; 

    node[block,right of=b3, minimum height=5em,  node distance=2.5cm] (b4) {More}; 

    node[block,right of=b4,minimum height=5em,   node distance=2.5cm] (b5) {no more}; 

    node[block,left of=b1, below of=b1, node distance=3cm,minimum height=7em] (c) {Addition};    

    node[block,right of=c, minimum height=7
         em, node distance=3cm] (c1) {Substraction}; 

    node[block,right of=c1,   node distance=3cm,minimum height=7
         em,text width=8em,,fill={rgb:black,1;white,8}] (c2) {Cool}; 

    node[block,below of=b4,   node distance=3cm,minimum height=7
         em,text width=8em, fill={rgb:black,1;white,8}] (c3) {warm};  

         node[block,below of=b5,   node distance=3cm,minimum height=7
         em,text width=4em,fill={rgb:black,1;white,8}] (c4) {cold)};  

 draw[line] (top.south)-- ++(0, -0.25) -|(a.north);     
 draw[line] (top.south)-- ++(0, -0.25) -|(b.north); 
 draw[line] (a.south)-- ++(0, -0.25) -|(b1.north); 
 draw[line] (a.south)-- ++(0, -0.25) -|(b2.north); 
 draw[line] (b.south)-- ++(0, -0.25) -|(b3.north); 
 draw[line] (b.south)-- ++(0, -0.5) -|(b4.north);
 draw[line] (b.south)-- ++(0, -0.25) -|(b5.north);
 draw[line] (b1.south)-- ++(0, -0.4) -|(c.north);
 draw[line] (b1.south)-- ++(0, -0.4) -|(c1.north);
 draw[line] (b2.south)--  ++(0, -0.4) -|(c2.north);
 draw[line] (b3.south)-- ++(0, -0.4) -|(c2.north); % <- here
 draw[line] (b4.south)-- ++(0, -0.4) -|(c3.north);
 draw[line] (b5.south)-- ++(0, -0.5) -|(c4.north);

end{tikzpicture}  

end{document}

Tagged : / /

Leave a Reply

Your email address will not be published. Required fields are marked *