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

  • @RüdigerVoigt this will work for the straight paths but not the curved path near the top of the picture. – Paul Gessler Mar 30 '14 at 20:16
  • So how to handle curved paths? – Andry Mar 30 '14 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); – Paul Gessler Mar 30 '14 at 23:36
  • 2
    I voted for re-opening as the linked question doesn't deal with curved arrows. – user11232 Mar 30 '14 at 23:39
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.