I have a problem with my Tikz Tree. The right edge that connects the node “NON Mammifero” in the first level, goes down at the same level of edge label “NO”. I would like it to stop at the first level with the node “Partorisce”. I try to use sibling distance and level distance, but (i don’t know why) doesn’t work. Thanks in advance. Here the library:
Tikz Tree problem with position
I have a problem with my Tikz Tree. The right edge that connects the node “NON Mammifero” in the first level, goes down at the same level of edge label “NO”. I would like it to stop at the first level with the node “Partorisce”. I try to use sibling distance and level distance, but (i don’t know why) doesn’t work. Thanks in advance. Here the library:
usepackage usetikzlibrary
Here the code:
begin[htbp] centering begin[sibling distance=5cm, level distance=3cm, every node/.style = < align=center, top color=white >] node[ellipse][draw] child < edge from parent node[above left,pos=.3]node[ellipse,draw] child < node[draw] edge from parent node[above left]> child < node[draw] edge from parent node[above right]> > child < node[draw] edge from parent node[above right] >; end vspace caption
Follow
205k 15 15 gold badges 391 391 silver badges 573 573 bronze badges
asked Dec 21, 2017 at 10:26
IvanComp IvanComp
47 4 4 bronze badges
please, always provide complete small document (called minimal working example: mwe) which show your problem and which we can copy and test. now we need to write it from your code segments. this is very disturbing in help to you. please, help us to help you!
Dec 21, 2017 at 10:40
2 Answers 2
Sorted by: Reset to default
Seems you need to move edge from parent node[..] to after the children of the Partorisce node.
documentclass usepackage usetikzlibrary begin begin[htbp] centering begin[ sibling distance=5cm, level distance=3cm, every node/.style = < align=center, top color=white >] node[ellipse][draw] child < node[ellipse,draw] child < node[draw] edge from parent node[above left] > child < node[draw] edge from parent node[above right] > edge from parent node[above left] % this is moved to after the children of the node > child < node[draw] edge from parent node[above right] >; end caption end end
For the heck of it, here’s a forest alternative, borrowing a bit from cfr’s answer to Drawing a game tree on Tikz forest is designed specifically for drawing trees.
documentclass usepackage usetikzlibrary begin begin[htbp] centering begin for tree=< l sep'+=25pt, s sep'+=5pt, >, Rect/.style=< draw, if=% >>% >> >, Ell/.style=< Rect=, ellipse >, Rect/.default=<>, Ell/.default=<> % [Termofisiologia, Ell [Partorisce, Ell= [Mammifero, Rect=] [NON Mammifero, Rect=] ] [NON Mammifero, Rect=] ] end caption end end