0

Having this in the preamble:

\usepackage{tikz}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{scopes}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes,calc}
\usetikzlibrary{automata,positioning}

I have the following figure:

\begin{figure}
       \centering
       \begin{tikzpicture}[start chain=going right,>=latex,node distance=0pt]
         \node[draw,rectangle,on chain,minimum size=1.5cm] (rr) {$I$};
         \node[draw,rectangle,on chain,draw=white,minimum size=0.8cm]{};
         % the rectangular shape with vertical lines
        \node[rectangle split, rectangle split parts=5,
        draw, rectangle split horizontal,text height=1cm,text depth=0.5cm,on chain,inner ysep=0pt] (wa) {};
         \fill[white] ([xshift=-\pgflinewidth,yshift=-\pgflinewidth]wa.north west) rectangle ([xshift=-15pt,yshift=\pgflinewidth]wa.south);
        \node at (wa.east) (A){};
        \draw [-latex] (A) --+(30:1.5) coordinate (B1);
        \draw [-latex] (A) --+(-30:1.5) coordinate (B2);
         % the circle
         \node [draw,circle,on chain,minimum size=1cm] at (B1) (se1) {$U_1$};
         \draw [-latex] (se1) --+(0:1.3) coordinate (BB1);
         \node [draw,circle,on chain,minimum size=1cm] at (B2) (se2) {$U_2$};
         \draw [-latex] (se2) --+(0:1.3) coordinate (BB2);
         \node [draw,diamond,on chain,minimum size=0.2cm] at (BB1) (C3){};
         \draw [-latex] (C3)--+(0:1)node[midway,above] {$\mu$};
         % the arrows and labels
         \draw[<-] (wa.west) -- +(-20pt,0) node[midway,below] {$\lambda$};
         \draw[->] (C3.north) to[out=120, in=145] ([shift=(up:.3)] wa.west);
       \end{tikzpicture}
          \caption{The model represented as a queuing system.}
             \label{fig:queue}
       \end{figure}

How to put labels on arrows where there are none (the picture below shows the edges where i want to put labels)?

enter image description here

4
  • @RüdigerVoigt this will work for the straight paths but not the curved path near the top of the picture. Commented Mar 30, 2014 at 20:16
  • So how to handle curved paths?
    – Andry
    Commented Mar 30, 2014 at 20:25
  • on a curved path the node specification must follow to. So the relevant line in your example should be \draw[->] (C3.north) to[out=120, in=145] node[below] {<label text>} ([shift=(up:.3)] wa.west); Commented Mar 30, 2014 at 23:36
  • 2
    I voted for re-opening as the linked question doesn't deal with curved arrows.
    – user11232
    Commented Mar 30, 2014 at 23:39

1 Answer 1

2

Converting my comment into an answer:

On a curved path, the node specification must follow to. So the relevant line in your example should be:

\draw[->] (C3.north) to[out=120, in=145] node[below] {<label text>} ([shift=(up:.3)] wa.west);

Also note that many of the libraries you've loaded are not required for this particular example; just chains and shapes (which includes shapes.multipart) are required.

Code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,shapes}

\begin{document}
\begin{figure}
       \centering
       \begin{tikzpicture}[start chain=going right,>=latex,node distance=0pt]
         \node[draw,rectangle,on chain,minimum size=1.5cm] (rr) {$I$};
         \node[draw,rectangle,on chain,draw=white,minimum size=0.8cm]{};
         % the rectangular shape with vertical lines
        \node[rectangle split, rectangle split parts=5,
        draw, rectangle split horizontal,text height=1cm,text depth=0.5cm,on chain,inner ysep=0pt] (wa) {};
         \fill[white] ([xshift=-\pgflinewidth,yshift=-\pgflinewidth]wa.north west) rectangle ([xshift=-15pt,yshift=\pgflinewidth]wa.south);
        \node at (wa.east) (A){};
        \draw [-latex] (A) --+(30:1.5) coordinate (B1);
        \draw [-latex] (A) --+(-30:1.5) coordinate (B2);
         % the circle
         \node [draw,circle,on chain,minimum size=1cm] at (B1) (se1) {$U_1$};
         \draw [-latex] (se1) --+(0:1.3) coordinate (BB1);
         \node [draw,circle,on chain,minimum size=1cm] at (B2) (se2) {$U_2$};
         \draw [-latex] (se2) --+(0:1.3) coordinate (BB2);
         \node [draw,diamond,on chain,minimum size=0.2cm] at (BB1) (C3){};
         \draw [-latex] (C3)--+(0:1)node[midway,above] {$\mu$};
         % the arrows and labels
         \draw[<-] (wa.west) -- +(-20pt,0) node[midway,below] {$\lambda$};
         \draw[->] (C3.north) to[out=120, in=145] node[below] {$X$} ([shift=(up:.3)] wa.west); % <<< additions here
       \end{tikzpicture}
          \caption{The model represented as a queuing system.}
             \label{fig:queue}
       \end{figure}
\end{document}

Output

enter image description here

You must log in to answer this question.

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