I manged to draw this diagram with tikz:

enter image description here with this code:



\tikzstyle{line} = [draw, -latex']
\tikzstyle{block} = [rectangle, draw, fill=blue!20, 
    text width=5em, text centered, rounded corners, minimum height=4em]

\begin{tikzpicture}[node distance = 5cm, scale=0.1]
    % Place nodes
    \node  [block](trr) {Node};
    \node  [block] (trr1) [below of=trr] {A};
    \node  [block] (trr2) [left of=trr1] {B};    
    \node  [block] (trr3) [right of=trr1] {C};      
    %\node  [block] (trr4) [right of=trr3] {D};        
    % Draw edges
    \path [line] (trr) -- (trr1);
    \path [line] (trr) -- (trr2);
    \path [line] (trr) -- (trr3);
    %\path [line] (trr) -- (trr4);


I would like that the block Node remains centered, and that I have 4 elements (A,B,C and D) in the second row. How can I achieve this?

Uncommenting the line

\node  [block] (trr4) [right of=trr3] {D};


\path [line] (trr) -- (trr4);  

results in enter image description here


You actually draw a tree .. so see if code below gives desired result:

enter image description here




every node/.style = {rectangle, draw, rounded corners, 
                     text width=3em, minimum height=2em, 
edge from parent/.style= {draw, -latex'}
\node (trr) {Node}
    child {node (trr1) {A}}
    child {node (trr2) {B}}
    child {node (trr3) {C}}
    child {node (trr4) {D}};

Addendum: After five (!) years I notice, that you like to have arrow at child ends on north of nodes. Using forest package this can be simply to o achieve:


for tree = {
% nodes
    draw, rounded corners, fill=blue!20,
    text width=3em, minimum height=2em, text centered,
% tree
    child anchor = north,
    l sep=11mm,
    s sep=1mm
    [A] [B] [C] [D]

enter image description here

  • Thank you perfect!! I don't even have to specify the edges now. Do you know if its easy to tell that the arrow of each edge should be at the center of the child( so for instance that the left arrow is above A).
    – Adam
    Mar 18 '16 at 15:52
  • @Adam, I'm very sorry but I only noticed your note now (after five years!)
    – Zarko
    Mar 1 at 17:10
  • haha no worries, my times with Latex are over ;)
    – Adam
    Mar 1 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.