tikz: Kante kollidiert mit Knoten

Tabellen und Grafiken erstellen und anordnen


musmus
Forum-Newbie
Forum-Newbie
Beiträge: 2
Registriert: Do 10. Sep 2015, 05:15

tikz: Kante kollidiert mit Knoten

Beitrag von musmus »

Ich möchte einen Pfeil vom unteren Teil der Box zum "i <= 1000"-Diamanten ziehen. Allerdings wird dieser Pfeil direkt über die Box gezogen, anstatt an dieser vorbeizuführen. Wie kann ich dies verhindern?
\documentclass[12pt,leqno,a4paper]{article}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\begin{document}
\begin{figure}
\begin{tikzpicture}[->,>=stealth',shorten >=0.5pt,auto,node distance=3cm,
		thick,cloud node/.style={cloud,draw,cloud puffs=10,cloud puff arc=120, aspect=2.5, inner ysep=1em}, circle node/.style={circle,draw},  square node/.style={rectangle,draw}, diamond node/.style={diamond,draw, aspect=2}]
		

		\node[diamond node] (1000) {$i \le 1000$};

		
		\node[square node] (ProdT1) [below of=1000] {More talented agent: Production};
		\node[square node, align=left] (1CatT0) [below left of=ProdT1] {Less talented agent:\\Categorisation};
		\node[square node, align=left] (1CatT1) [below right of=ProdT1] {More talented agent:\\Categorisation};
		\node[draw, fit=(ProdT1) (1CatT0) (1CatT1)] (BoxIni1) {};	
		
		\path[every node/.style={font=\sffamily\small}]	
		(1000) edge node {yes} (BoxIni1)	
		(ProdT1) edge node {} (1CatT0)
		(ProdT1) edge node {} (1CatT1)
		(BoxIni1.south) edge node {} (1000);
		\end{tikzpicture}
\end{figure}
\end {document}

Beinschuss
Forum-Meister
Forum-Meister
Beiträge: 809
Registriert: Di 2. Okt 2012, 21:42
Wohnort: NRW

Beitrag von Beinschuss »

Es mag elegantere Lösungen geben, aber:
\documentclass[12pt,leqno,a4paper]{article}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\begin{document}
\begin{figure}
\begin{tikzpicture}[->,>=stealth',shorten >=0.5pt,auto,node distance=3cm,
      thick,cloud node/.style={cloud,draw,cloud puffs=10,cloud puff arc=120, aspect=2.5, inner ysep=1em}, circle node/.style={circle,draw},  square node/.style={rectangle,draw}, diamond node/.style={diamond,draw, aspect=2}]
    
      \node[diamond node] (1000) {$i \le 1000$};
      
      \node[square node] (ProdT1) [below of=1000] {More talented agent: Production};
      \node[square node, align=left] (1CatT0) [below left of=ProdT1] {Less talented agent:\\Categorisation};
      \node[square node, align=left] (1CatT1) [below right of=ProdT1] {More talented agent:\\Categorisation};
      \node[draw, fit=(ProdT1) (1CatT0) (1CatT1)] (BoxIni1) {};   
      
      \path[every node/.style={font=\sffamily\small}]   
      (1000) edge node {yes} (BoxIni1)   
      (ProdT1) edge node {} (1CatT0)
      (ProdT1) edge node {} (1CatT1);
      \draw (BoxIni1.south) |- (-5,-7) |- (1000.west);
      \end{tikzpicture}
\end{figure}
\end {document}
sollte funktionieren.

Helmut

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Möglich wäre auch
\draw (BoxIni1.south) |- ([xshift=-2em,yshift=-2em]BoxIni1.south west) |- (1000.west); 
Dann muss keine absolute Koordinate angegeben werden, sondern nur der horizontale bzw. vertikale Abstand zur Box (hier beides 2em).

Gruß
Elke

Beinschuss
Forum-Meister
Forum-Meister
Beiträge: 809
Registriert: Di 2. Okt 2012, 21:42
Wohnort: NRW

Beitrag von Beinschuss »

Elkes Lösung hat den Vorteil, dass die Zeichnung stabil bleibt, wenn man noch weitere Elemente einfügt und sich dadurch was verschiebt. Sie ist daher vorzuziehen.

Antworten