Set endpoint of arrows in tikz
I could not get your code compiling until I replaced ####1
by #1
in line 19. If you have more complicated annotations, you may find it more convenient to replace the loop by explicit commands.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{shapes,calc}
\usetikzlibrary{automata,arrows,shapes,snakes,automata,backgrounds,petri,positioning}
\tikzset{
myshape/.style={
rectangle split,
minimum height=1.5cm,
rectangle split horizontal,
rectangle split parts=2,
draw,
text width=2cm,
anchor=center,
}
}
\begin{document}
\begin{tikzpicture}[scale = 0.2,bend angle = 35, inner sep=2mm,
queue/.style={rectangle split, rectangle split horizontal,rectangle split draw splits = false,rectangle split part fill = {white!100,#1} , rectangle split parts=2, draw, anchor=center, minimum height = 1cm},
dispatcher/.style={rectangle,draw=blue!50!black,fill=blue!20!white,thick, minimum height = 1cm, minimum width = 1.5cm}]
\node[dispatcher] (disp) {};
\node[queue = gray!50] (queue2) [above right= 0.1cm and 3cm of disp] {$\qquad$ \nodepart{two}$\qquad \qquad \qquad \qquad$};
\node[queue = red!50] (queue1) [above=0.3cm of queue2] {$\qquad\qquad \qquad$ \nodepart{two}$\qquad \qquad$}(disp.east);
\node[queue = green!50] (queue3) [below right=0.1cm and 3cm of disp] {$\qquad\qquad \qquad \qquad$ \nodepart{two}$\qquad$} (disp.east);
\node[queue = red!50] (queue4) [below=0.3cm of queue3] {$\qquad$ \nodepart{two}$\qquad \qquad \qquad \qquad$} (disp.east);
\draw[loosely dotted, line width = 0.4mm] (queue2) -- (queue3);
\foreach \a in {1,...,4}
{\draw[ultra thick, in=180,out=50-\a*20,thick,->] (disp.east) to
node[midway,above] {\a}
(queue\a.west);
};
\end{tikzpicture}
\end{document}
You should specify explicitly the begin and end of the arrows. An easy way to connect these arrows is using edge
and text is added by using node[above,pos=.9]{text}
.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{shapes,calc}
\usetikzlibrary{automata,arrows,shapes,snakes,automata,backgrounds,petri,positioning}
\tikzset{
myshape/.style={
rectangle split,
minimum height=1.5cm,
rectangle split horizontal,
rectangle split parts=2,
draw,
text width=2cm,
anchor=center,
}
}
\begin{document}
\begin{tikzpicture}[scale = 0.2,bend angle = 35, inner sep=2mm,
queue/.style={rectangle split, rectangle split horizontal,rectangle split draw splits = false,rectangle split part fill = {white!100,#1} , rectangle split parts=2, draw, anchor=center, minimum height = 1cm},
dispatcher/.style={rectangle,draw=blue!50!black,fill=blue!20!white,thick, minimum height = 1cm, minimum width = 1.5cm}]
\node[dispatcher] (disp) {};
\node[queue = gray!50] (queue2) [above right= 0.1cm and 3cm of disp] {$\qquad$ \nodepart{two}$\qquad \qquad \qquad \qquad$};
\node[queue = red!50] (queue1) [above=0.3cm of queue2] {$\qquad\qquad\qquad$ \nodepart{two}$\qquad \qquad$};
\node[queue = green!50] (queue3) [below right=0.1cm and 3cm of disp] {$\qquad\qquad\qquad\qquad$\nodepart{two}$\qquad$};
\node[queue = red!50] (queue4) [below=0.3cm of queue3] {$\qquad$\nodepart{two}$\qquad\qquad\qquad\qquad$};
\draw[loosely dotted, line width = 0.4mm] (queue2) -- (queue3);
\path (disp.east) edge [->, bend right,line width = 0.4mm]node[above,pos=.85]{text3} (queue3.west)
edge [->, bend right,line width = 0.4mm]node[above,pos=.9]{text4} (queue4.west)
edge [->, bend left,line width = 0.4mm]node[above,pos=.9]{text1} (queue1.west);
\end{tikzpicture}
\end{document}
slightly modification of nice marmot answer. adopted to beamer document class, with simplified arrows, use of chains
and quotes
library. All not used tikz
libraries and style definition are removed to obtain mwe (minimal working example):
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, chains, quotes, positioning, shapes.multipart}
\tikzset{scheduler/.style = {
node distance = 3mm and 33mm,
start chain = A going below,
queue/.style = {rectangle split, rectangle split horizontal, rectangle split parts=2,
rectangle split draw splits=false,
rectangle split part fill={white!100,##1},
draw, minimum height = 1cm,
on chain=A},
dispatcher/.style = {rectangle, draw=blue!50!black, fill=blue!20!white, thick,
minimum height=1cm, minimum width = 1.5cm},
every edge quotes/.append style = {auto, anchor=south east, sloped, pos=0.9}
}}
\begin{document}
\begin{frame}
\frametitle{Scheduler}
\begin{tikzpicture}[scheduler]
\node[queue=gray] {$\qquad$
\nodepart{two}$\qquad \qquad \qquad \qquad$};
\node[queue=red] {$\qquad\qquad \qquad$
\nodepart{two}$\qquad \qquad$};
\node[queue=green,below=16mm of A-2]
{$\qquad\qquad \qquad \qquad$
\nodepart{two}$\qquad$};
\node[queue=red!50] {$\qquad$
\nodepart{two}$\qquad \qquad \qquad \qquad$};
%
\node[dispatcher,below left=of A-2] (disp) {};
%
\draw[loosely dotted, line width=0.4mm,
shorten >=1mm, shorten <=1mm] (A-2) -- (A-3);
\path[thick,-Stealth]
(disp.east) edge ["text 1"] (A-1.west)
(disp.east) edge ["text 2"] (A-2.west)
(disp.east) edge ["text 3"] (A-3.west)
(disp.east) edge ["text 4"] (A-4.west);
\end{tikzpicture}
\end{frame}
\end{document}