Can I use \path to draw a line that goes through 2 edges.
Consider:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzstyle{status} = [rectangle, draw=black, text centered, anchor=north, text=black, minimum width=2em, minimum height=2em, node distance=6ex and 7em, font=\bfseries]
\tikzstyle{line} = [draw,thick,-latex]
\tikzstyle{transition} = [font=\small]
\begin{document}
\begin{tikzpicture}
\node [status, fill=green] (T) {H};
\node [status, fill=red, right=4em of T] (A) {A};
\node [status, fill=gray, right=4em of A] (D) {D};
\path [line] (T) -- (A) node[transition,pos=0.5,above,align=left] {$\#A \geq 1$};
\path [line] (A) -- (D) node[transition,pos=0.5,above,align=left] {wait $\tau$ tick\\$\tau\sim\mathcal{G}(\lambda)$};
%\path [line] (D) -| (T) node[transition,pos=0.83,left] {$p_{repl}$};
\end{tikzpicture}
\end{document}
Screenshot:
Mockup of what I want:
Easier than we thought, you can make it substituting the commented line (line number 17) in your code with:
\path [line] (D) -- ++(0,-1) -- +(-4.25,0) -- (T) node[transition,pos=0.3,right] {$p_{repl}$};
The output:
Improvement: even better, using -|
and then one aux point only instead of two (one is needed):
\path [line] (D) -- ++(0,-1) -| (T) node [transition,pos=0.8,left] {$p_{repl}$};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With