3

How would I draw the following diagram?

enter image description here

Please can you put $\epsilon$ on the left rather than the right.

The best I can do is:

\begin{tikzpicture}[node distance=2cm, on grid]
  \tikzset{
    mynode/.style = {circle,draw,minimum width=8mm,inner sep=0pt},
    > = {Stealth[scale=1.5]}
  }
  \node [mynode] (A1) {S};
  \node [mynode,right=of A1] (B1) {I_1};
  \node [mynode,right=of B1] (C1) {I_2};
  \node [mynode,right=of C1] (D1) {J};
  \draw [<-] (A1) -- ++(-1,0) node[left] {$\mu$};
  \draw [->] (A1) -- node[above] {$\beta$} (B1);
  \draw [->] (B1) -- node[above] {$\sigma$} (C1);
  \draw [->] (C1) -- node[above] {$\gamma$} (D1);
  \draw [->] (A1) -- ++(0,-1) node[below] {$\nu$};
  \draw [->] (B1) -- ++(0,-1) node[below] {$\nu$};
  \draw [->] (C1) -- ++(0,-1) node[below] {$\nu$};
  \draw [->] (D1) -- ++(0,-1) node[below] {$\nu$};
  \draw [->] (D1) to[out=135,in=45] node[above] {$\xi$} (A1);
\end{tikzpicture}

This is what I'm looking for:

\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 11mm and 33mm,
     N/.style = {draw, minimum size=12mm, inner sep=0pt},
            > = {Stealth[scale=0.8]},
 every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
                                   inner sep=5pt, sloped}
                        ]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E)  {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\nu S$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\nu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\nu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\nu J$};
\draw [->] ([xshift=-3.5mm] E.south) -- ++(0,-0.4) node[below] {$\nu \alpha$};
\draw [->] ([xshift=+3.5mm] E.south) -- ++(0,-0.4) node[below] {$\nu A$};
%
\draw   ([yshift=+1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        p\beta_1 I_1\\
                        q\beta_2 JS\\
                        r\beta_3 AS
                    \end{gathered}$"] (B.west)
        ([yshift=-1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        (1-p)\beta_2 I_1\\
                        (1-q)\beta_2 JS\\
                        (1-r)\beta_3 AS
                    \end{gathered}$" '] (C.west)
        (B) edge ["$\epsilon I_1$"] (C)
        (D.west) edge ["$\xi_1 J$"  ] ( B.east)
        ( C.east) edge ["$p_1 I_2$"  ] (D.west)
        ([yshift=-2mm] D.west) edge ["$\xi_2 J$" '] ([yshift=-2mm] C.east)
    (D) edge ["$p_2 J$"] (E);
\end{tikzpicture}
\end{document}

How do I flip the $\epsilon I_1$ so it reads left to right rather than on the side?

4
  • (i) make more clear sketch (ii) what you try so far? With use of the tikz package this should not be so big deal ...
    – Zarko
    Commented Nov 18, 2021 at 14:47
  • @Zarko I don't know how to make it clearer?
    – Math
    Commented Nov 18, 2021 at 14:49
  • Sorry, bur I cant read what you write on your sketch. But, more important is: show us what you try so far. BTW, this site is not intended for service: we-do-your task-instead-of-you. So. your questions seems to be closed soon.
    – Zarko
    Commented Nov 18, 2021 at 14:52
  • @Zarko i added something but it is way off.. and I would like square boxes
    – Math
    Commented Nov 18, 2021 at 15:34

2 Answers 2

5

Well, your MWE is not very close to what you like to have. So, since you are novice to site as well to LaTeX/TikZ, the following MWE can serve as starting point to desired solution:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}
                
\begin{document}
    \begin{tikzpicture}[
node distance = 11mm and 22mm,
     N/.style = {draw, minimum size=12mm, inner sep=0pt},
            > = {Stealth[scale=0.8]},
 every edge/.append style = {draw, ->, inner sep=5pt, sloped}
                        ]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E)  {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw   ([yshift=+1mm] A.east) 
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "${x,y,z}$" sloped] (B.west)
        ([yshift=-1mm] A.east) 
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "${x',y',z'}$" sloped] (C.west)
        (B) edge ["$\sigma$"] (C)
        (B.east) edge ["$???$"  ] ([yshift=+1mm] D.west)
        ( C.east) edge ["$???$"  ] (D.west)
        ([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
    (D) edge ["$???$"] (E);
\end{tikzpicture}
\end{document}

enter image description here

Addendum Still as starting point ... I still don't know, what are your edge labels. Anyway, from you comment I guess that from node S to nodes I_1 and I_2 are as shows the following image:

enter image description here

For this I made in the first MWE the following changes:

  • load package amsmath
  • increase distances between nodes
  • very long edge labels write in three lines by use of the gathered environment
\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 11mm and 33mm,
     N/.style = {draw, minimum size=12mm, inner sep=0pt},
            > = {Stealth[scale=0.8]},
 every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
                                   inner sep=5pt, sloped}
                        ]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E)  {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw   ([yshift=+1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        p\beta_1 I_1\\
                        q\beta_2 JS\\
                        r\beta_3 AS
                    \end{gathered}$"] (B.west)
        ([yshift=-1mm] A.east)
            edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
                  "$\begin{gathered}
                        (1-p)\beta_2 I_1\\
                        (1-q)\beta_2 JS\\
                        (1-r)\beta_3 AS
                    \end{gathered}$" '] (C.west)
        (B) edge ["$\sigma$"] (C)
        (B.east) edge ["$???$"  ] ([yshift=+1mm] D.west)
        ( C.east) edge ["$???$"  ] (D.west)
        ([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
    (D) edge ["$???$"] (E);
\end{tikzpicture}
\end{document}

If you more prefer three lines between nodes S and I_1, I_2, please consider other answer.

23
  • That's a much better solution for the three parallel arrows! Commented Nov 18, 2021 at 21:20
  • @JasperHabicht, thank you very much :-). Used notation is standardized in some electrical engineering fields (electrical power grid schemes, for example). I just borrow from them :-)
    – Zarko
    Commented Nov 18, 2021 at 21:27
  • @Zarko Thank you for your solution. The triple arrows from node $S$ to node $I_1$ should actually read $p \beta_1 I_2 S$, $q \beta_2 J S$ and $ r \beta_3 A S$. Similarly triple arrows from node $S$ to node $I_2$ should read $(1-p) \beta_1 I_2 S$, $(1-q) \beta_2 J S$ and $(1- r) \beta_3 A S$. I just simplified it down to x,y,z to make it more readable.
    – Math
    Commented Nov 22, 2021 at 11:48
  • @Zarko Following from my above comment, I don't think everything will "fit" using this notation so could you also amend the diagram for the triple arrows from the information above? I think the triple separate arrows method will be better.
    – Math
    Commented Nov 22, 2021 at 11:55
  • @Math, how to draw three arrows you can see in another answer. If drawing three is better is mater of taste.
    – Zarko
    Commented Nov 22, 2021 at 12:13
4

Since you provided something to work with, let me give you a first approach. I did not finish the drawing, since I only wanted to provide some ideas and also some parts of your scan are really hard to read.

\documentclass[tikz, border=1mm]{standalone}

\usetikzlibrary{positioning, arrows.meta}

\begin{document}
  
\begin{tikzpicture}[node distance=2.5cm, on grid]
  \tikzset{
    font=\footnotesize,
    > = {Stealth[scale=1.5]},
    mynode/.style = {rectangle, draw, minimum width=8mm, minimum height=8mm, inner sep=0pt, font=\normalsize},
    label/.style = {circle, fill=white, inner sep=0.25pt},
  }
  
  \node [mynode] (A1) {S};
  \node [mynode, above right=of A1] (B1) {$I_1$};
  \node [mynode, below right=of A1] (C1) {$I_2$};
  \node [mynode, above right=of C1] (D1) {$J$};
  \node [mynode, right=of D1] (E1) {$A$};
  
  \draw [<-] (A1) -- ++(-1,0) node[left] {$J$};
  
  \draw [->] (A1) -- node[right] {$z$} (B1);
  \draw [->] ([xshift=-2.5mm]A1.north east) -- node[label] {$y$} ([yshift=2.5mm]B1.south west);
  \draw [->] ([xshift=-5mm]A1.north east) -- node[left] {$x$} ([yshift=5mm]B1.south west);
  
  \draw [->] ([xshift=-1.5mm]B1.south) -- node[left] {$\epsilon$} ([xshift=-1.5mm]C1.north);
  \draw [->] ([xshift=1.5mm]B1.south) -- ++(0,-.5) node[below] {$\mu_{I_1}$};

  \draw [->] (A1) -- ++(0,-1) node[below] {$\mu_S$};

  % ... 

\end{tikzpicture}

\end{document}

enter image description here

You should probably get familiar with the options yshift and xshift that allow you to shift a node from its current position. Also, you should probably be aware of anchors. Each node comes with a set of anchors such as north east which would be the upper right corner of the node. You can refer to these anchors by appending them using a dot to the node name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .