As I explored the TikZ manual and available examples; the position of child nodes are defined within the parent node. This means that all child nodes spread on the same radius from the parent with constant angle intervals.

How to define the level dsiatance and sibling angle individually for each child node?

\node[ball color=red,circle] (parent) at (5,5) {Parent}
    [level distance=4cm,sibling angle=30,clockwise from=0]
    child {node[rectangle,fill=red,color=white]
    {e.g. 2cm from parent at angle 0}}
    child {node[rectangle,fill=red,color=white]
    {e.g. 5cm from parent at angle 20}}
    child {node[rectangle,fill=red,color=white]
    {e.g. 3cm from parent at angle 60}};

Instead of constant distance from parent and equal angle between child nodes defined in

[level distance=4cm,sibling angle=30,clockwise from=0]

How to define a custom (independent) value for each child?

  • 1
    Can you post the "full" code? I mean, adding the preamble and the closing tags.
    – Alenanno
    Jun 4 '12 at 9:14
  • As Alenanno said, it would be good if you could always post full examples, including the \documentclass and the necessary libraries. It seems like a trivial thing for examples like these, but if you already include the necessary lines, it saves everyone else the work of having to add them themselves (and wondering why the example doesn't compile, until they figure out that the trees library needs to be loaded).
    – Jake
    Jun 4 '12 at 9:25
  • 1
    @Jake you're quite right! I will keep it in mind for future questions.
    – Googlebot
    Jun 4 '12 at 9:29

You can pass the level distance and sibling angle options to the child keywords:


\node[ball color=red,circle] (parent) at (5,5) {Parent}
    [clockwise from=0]
    child [level distance=2cm] {node[rectangle,fill=red]
    child [level distance=4cm, sibling angle=20] {node[rectangle,fill=red]
    child [level distance=3cm, sibling angle=30] {node[rectangle,fill=red]

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.