Can someone please help with a code that will draw this flow chart diagram in Latex.The image is given the picture below.
Asked
Active
Viewed 161 times
-2
KersouMan
- 1,850
- 3
- 13
- 15
-
3Welcome. // Please take the little burdon to work through one or all 4 tutorials in Part I of https://ctan.org/pkg/pgf and you can draw almost anything from the screenshot. – MS-SPO May 30 '23 at 11:21
-
3Welcome to TeX.SX! This site works best if you ask a specific question to a specific problem. I am quite sure that there are already a lot of nice examples for similar diagrams on this site (for example here or here) which you can use as starting points for your diagram. Once you got stuck, show your code. This will make it much easier for us to help you. – Jasper Habicht May 30 '23 at 11:43
1 Answers
2
While a code showing what has been tried should be posted with such questions, I wanted to play around a bit with the automata library.
Here is a solution
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usetikzlibrary{automata}
\begin{document}
\begin{tikzpicture}[node distance = 1cm and 2cm, > = Stealth, accepting/.style = accepting by arrow]
\node[%
state, rectangle, fill = red,%
accepting, accepting text = {$(\mu + \omega_1)\mathrm{A}$}] (A) {A};
\node[%
state, rectangle, fill = blue!40!white, above right = of A,%
initial above, initial text = {$(1 - p)\mu v$},%
accepting, accepting text = {$\mu\mathrm{E}$}] (E) {E};
\node[%
state, rectangle, fill = green, below right = of A,%
accepting, accepting text = {$\mu\mathrm{Q}$}] (Q) {Q};
\node[%
state, rectangle, fill = yellow, below left = of A,
accepting left, accepting text = {$(\mu + \omega_2)\mathrm{R}$}] (R) {R};
\node[%
state, rectangle, fill = green!30!white, above left = of A,%
initial above, initial text = {$p\mu v$},%
accepting left, accepting text = {$\mu\mathrm{S}$}] (S) {S};
\path[->] (A) edge[bend right] node[above left] {$\pi\mathrm{A}$} (R)
(E) edge node[above left] {$\varepsilon\eta\mathrm{EA}$} (A)
(E) edge node[right] {$\lambda\mathrm{E}$} (Q)
(R) edge[bend right] node[near end, below right] {$\rho\mathrm{R}$} (A)
(R) edge node[below] {$\theta\mathrm{R}$} (Q)
(S) edge node[above right] {$\varepsilon\mathrm{SA}$} (A)
(S) edge node[above] {$\gamma\mathrm{S}$} (E);
\end{tikzpicture}
\end{document}
KersouMan
- 1,850
- 3
- 13
- 15
-
If you set
node distance = 1cm and 2cmyou can then later leave it out from the… ofs. – Qrrbrbirlbel May 30 '23 at 12:43 -
@Qrrbrbirlbel Thanks! I wasn't sure of that and did not test. I edited accordingly – KersouMan May 30 '23 at 12:44
