Archiv verlassen und diese Seite im Standarddesign anzeigen : Baumdiagramm beschriften
Hallo zusammen!
Wie kann ich die einzelnen Äste des Baumdiagramms mit Brüchen beschriften?
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {}
child {node {A}
child {node {E}
child{node{L}
}
}
child {node {L}
child{node{E}
}
}
}
child {node {E}
child {node {A}
child{node{L}
}
}
child {node {L}
child{node{A}
}
}
}
child {node {L}
child {node {A}
child{node{E}
}
}
child {node {E}
child{node{A}
}
}
}
;
\end{tikzpicture}
\end{document}
Wenn ich einfach
edge from parent node[left] {$\frac{1}{3}$}
dranhänge, dann zerschießt es mir den Bau, siehe
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {}
child {node {A}
edge from parent node[left] {$\frac{1}{3}$}
child {node {E}
child{node{L}
}
}
child {node {L}
child{node{E}
}
}
}
child {node {E}
child {node {A}
child{node{L}
}
}
child {node {L}
child{node{A}
}
}
}
child {node {L}
child {node {A}
child{node{E}
}
}
child {node {E}
child{node{A}
}
}
}
;
\end{tikzpicture}
\end{document}
bobmalaria
22-11-2012, 17:08
hi,
an der richtigen stelle und mit der kleinen aber feinen veraenderung draw=none geht es
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {Root}
child {node {A} edge from parent node[above,draw=none] {$\frac{1}{3}$}}
child {node {E}
child{node{L}
}
child {node {L}
child{node{E}
}
}
}
child {node {E}
child {node {A}
child{node{L}
}
}
child {node {L}
child{node{A}
}
}
}
child {node {L}
child {node {A}
child{node{E}
}
}
child {node {E}
child{node{A}
}
}
}
;
\end{tikzpicture}
\end{document}
http://www.mrunix.de/forums/attachment.php?attachmentid=5485&stc=1&d=1353600565
Hallo!
hi,
an der richtigen stelle und mit der kleinen aber feinen veraenderung draw=none geht es
http://www.mrunix.de/forums/attachment.php?attachmentid=5485&stc=1&d=1353600565
Allerdings rutschen dann die nächsten "Kinder"-Kategorie eine Ebene nach rechts. Ich hätte die gerne unterhalb der "Eltern"-Kategorie "A".
So klappt es aber auch nicht, da dann die Kinder an die Beschriftung 1/3 angehängt sind:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {Root}
child {node {A} edge from parent node[above,draw=none] {$\frac{1}{3}$}
child {node {E}
child {node{L}
}
}
child {node {L}
child{node{E}
}
}
}
child {node {E}
child {node {A}
child{node{L}
}
}
child {node {L}
child{node{A}
}
}
}
child {node {L}
child {node {A}
child{node{E}
}
}
child {node {E}
child{node{A}
}
}
}
;
\end{tikzpicture}
\end{document}
http://www.mrunix.de/forums/attachment.php?attachmentid=5486&d=1353602677
Hallo,
wenn das 1/3 an den Ast von "root" zu "child A" geschrieben werden soll, dann muss das "edge from parent node" direkt vor der schließenden Klammer des "child A" geschrieben werden.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{trees}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {root}
child {node {child A}
child {node {E}
child{node{L}
}
}
child {node {L}
child{node{E}
}
}
edge from parent node[above] {$\frac{1}{3}$}}
child {node {E}
child {node {A}
child{node{L}
}
}
child {node {L}
child{node{A}
}
}
}
child {node {L}
child {node {A}
child{node{E}
}
}
child {node {E}
child{node{A}
}
}
}
;
\end{tikzpicture}
\end{document}
Gruß
Elke
Hallo!
wenn das 1/3 an den Ast von "root" zu "child A" geschrieben werden soll, dann muss das "edge from parent node" direkt vor der schließenden Klammer des "child A" geschrieben werden.
Prima vielen Dank für den Tipp, jetzt funktioniert es.
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {}
child {node {A}
child {node {E}
child {node{L}
edge from parent node[left,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
child {node {L}
child{node{E}
edge from parent node[right,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
edge from parent node[above,draw=none] {$\frac{1}{3}$}}
child {node {E}
child {node {A}
child{node{L}
edge from parent node[left,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
child {node {L}
child{node{A}
edge from parent node[right,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
edge from parent node[left,draw=none] {$\frac{1}{3}$}}
child {node {L}
child {node {A}
child{node{E}
edge from parent node[left,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
child {node {E}
child{node{A}
edge from parent node[right,draw=none] {$1$}}
edge from parent node[above,draw=none] {$\frac{1}{2}$}}
edge from parent node[above,draw=none] {$\frac{1}{3}$}}
;
\end{tikzpicture}
\end{document}
Noch eine Schönheitskorrektur: Die Brüche kleben in der 2. Ebene noch zu sehr an den Linien. Wie kann ich dies korrigieren?
http://www.mrunix.de/forums/attachment.php?attachmentid=5488&stc=1&d=1353663873
Du kannst die nodes auch noch etwas mit xshift/yshift verschieben, zum Beispiel:
edge from parent node[above,draw=none,xshift=-2pt] {$\frac{1}{2}$}} % 2 pt nach links verschieben
Oder du verwendest bei den schrägen Ästen einfach above left bzw. above right.
edge from parent node[above left] {$\frac{1}{2}$}}
Das draw=none ist übrigens nicht notwendig.
Oder du verwendest bei den schrägen Ästen einfach above left bzw. above right.
edge from parent node[above left] {$\frac{1}{2}$}}
Das draw=none ist übrigens nicht notwendig.
Vielen Dank! jetzt ist es perfekt!
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\pagestyle{empty}
\begin{document}
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=0pt,fill, inner sep=0pt]
\begin{tikzpicture}[level distance=20mm]
\tikzstyle{level 1}=[sibling distance=5cm]
\tikzstyle{level 2}=[sibling distance=3cm]
\tikzstyle{level 3}=[sibling distance=1.5cm]
\node {}
child {node {A}
child {node {E}
child {node{L}
edge from parent node[left] {$1$}}
edge from parent node[above left] {$\frac{1}{2}$}}
child {node {L}
child{node{E}
edge from parent node[right] {$1$}}
edge from parent node[above right] {$\frac{1}{2}$}}
edge from parent node[above] {$\frac{1}{3}$}}
child {node {E}
child {node {A}
child{node{L}
edge from parent node[left] {$1$}}
edge from parent node[above left] {$\frac{1}{2}$}}
child {node {L}
child{node{A}
edge from parent node[right] {$1$}}
edge from parent node[above right] {$\frac{1}{2}$}}
edge from parent node[left] {$\frac{1}{3}$}}
child {node {L}
child {node {A}
child{node{E}
edge from parent node[left] {$1$}}
edge from parent node[above left] {$\frac{1}{2}$}}
child {node {E}
child{node{A}
edge from parent node[right] {$1$}}
edge from parent node[above right] {$\frac{1}{2}$}}
edge from parent node[above] {$\frac{1}{3}$}}
;
\end{tikzpicture}
\end{document}
http://www.mrunix.de/forums/attachment.php?attachmentid=5489&stc=1&d=1353670683
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.