3

I am trying to draw the below digram:

enter image description here

Till now I am able to do this much:

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,0) {(2,3)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (b) at (2,1) {(2,4)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,2) {(4,2)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,3) {(2,5)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,4) {(6,2)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,5) {(6,4)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (2,6) {(7,2)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (8,3) {(2,3)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (b) at (8,4) {(2,4)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (8,5) {(4,2)};
\node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm] (a) at (8,6) {(2,5)};
\node[draw,fill=Red!60,minimum width=3cm,minimum height=1cm] (a) at (14,3) {(2,3)};
\node[draw,fill=Red!60,minimum width=3cm,minimum height=1cm] (b) at (14,4) {(2,4)};
\node[draw,fill=Red!60,minimum width=3cm,minimum height=1cm] (a) at (14,5) {(4,2)};
\node[draw,fill=Red!60,minimum width=3cm,minimum height=1cm] (a) at (14,6) {(2,5)};
\end{tikzpicture}

\end{document}

Giving me output: enter image description here

2

You can use a brace decoration for the brace and make extra nodes for the label. You can also reduce the redundancies in your code a lot by an appropriate use of \foreach.

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[decoration={brace,amplitude=2mm,mirror},]
\foreach[count=\i] \x/\y in {7/2,6/4,6/2,2/5,4/2,2/4,2/3}
    \node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm,below] (a) at (2,-\i) {(\x,\y)};

\foreach[count=\i] \x/\y in {2/5,4/2,2/4,2/3}{
    \node[draw,fill=LightSteelBlue!60,minimum width=3cm,minimum height=1cm,below] (b) at (8,-\i) {(\x,\y)};
    \node[draw,fill=Red!60,minimum width=3cm,minimum height=1cm,below] (c) at (14,-\i) {(\x,\y)};
}
\draw [decorate] (0.3,-1) --node[left=3mm]{$S_1$} (0.3,-3);
\draw [decorate] (0.3,-4) --node[left=3mm]{$S_2$} (0.3,-6);

\node[align=center,below] at (2,-9) (alabel) {$S$\\ explicit};
\node[align=center,below] at (8,-6) (blabel) {$S'$\\ used};
\node[align=center,below] at (14,-6) (clabel) {$T$};

\draw[->]
    (a) edge (alabel)
    (b) edge (blabel)
    (c) edge (clabel)
;
\end{tikzpicture}

\end{document} 

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.