\begin{tikzpicture}[x=1cm,y=.90cm,font=\small,>=Latex, profile/.style={circle,draw,fill=white,minimum size=15pt,inner sep=0pt}, used/.style={fill=blue!12,draw=blue!65!black}, last/.style={fill=orange!15,draw=orange!80!black}] \node[anchor=west] at (-.35,4.55) {(a) Integer vectors}; \draw[->] (-.35,0)--(3.75,0) node[right] {$x_1$}; \draw[->] (0,0)--(0,3.6) node[above] {$x_2$}; \foreach \r in {1,2,3}{\draw[dashed,black!30] (0,\r)--(\r,0);} \foreach \x/\y in {0/0,1/0,0/1,2/0,1/1,0/2}{\node[profile,used] at (\x,\y) {2};} \node[profile,last] at (3,0) {2}; \node[profile,last] at (2,1) {1}; \node[profile] at (1,2) {0}; \node[profile] at (0,3) {0}; \foreach \t in {0,1,2,3}{\node[below,inner sep=1pt] at (\t,-.32) {$\t$};} \foreach \t in {1,2,3}{\node[left,inner sep=1pt] at (-.32,\t) {$\t$};} \node[anchor=west] at (5.25,4.55) {(b) Count and cost by layer}; \node at (5.65,3.4) {$r$}; \node at (8.2,3.4) {occurrences}; \node at (11.85,3.4) {cost}; \foreach \r/\y/\cap/\occ/\val in {0/2.8/2/2/0,1/2.05/4/4/4,2/1.3/6/6/12,3/.55/8/3/9}{ \node at (5.65,\y) {$\r$}; \foreach \j in {1,...,\cap}{ \draw[black!45] ({6.25+.5*(\j-1)},\y-.18) rectangle ++(.38,.36); } \foreach \j in {1,...,\occ}{ \ifnum\r<3 \def\col{blue!65!black}\else\def\col{orange!80!black}\fi \fill[\col] ({6.25+.5*(\j-1)},\y-.18) rectangle ++(.38,.36); } \node at (11.85,\y) {$\r\cdot\occ=\val$}; } \draw[black!50] (5.25,-.02)--(12.6,-.02); \node at (8.05,-.47) {$2+4+6+3=15$}; \node at (11.85,-.47) {$25$}; \end{tikzpicture}