Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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. –  All Jun 4 '12 at 9:29
add comment

1 Answer

up vote 6 down vote accepted

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

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}

\begin{document}
\begin{tikzpicture}
\node[ball color=red,circle] (parent) at (5,5) {Parent}
    [clockwise from=0]
    child [level distance=2cm] {node[rectangle,fill=red]
    {A}}
    child [level distance=4cm, sibling angle=20] {node[rectangle,fill=red]
    {B}}
    child [level distance=3cm, sibling angle=30] {node[rectangle,fill=red]
    {C}};
\end{tikzpicture}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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