# Block diagram in Tikz with absolute positioning?

I'm trying to recreate an image using Tikz from a presentation about market structure:

I'm having a very hard time specifying absolute positions for each node. What's the best way to assign block positions for something like this?

Here's what I have so far:

\tikzstyle{trade} = [rectangle, minimum height=0.5cm, text
centered, color=white, draw=black, fill=red]
\tikzstyle{order} = [rectangle, minimum height=0.5cm, text
centered, color=white, draw=black, fill=blue]

\begin{tikzpicture}[node distance=1cm]

\node (trade) at (0, 0) [trade, minimum width=6cm] {Marketable Order};

\node (o1) [order, below of=trade, minimum width=0.5cm, xshift=-2.75cm, node
distance=2cm] {1};
\node (o2) [order, right of=o1, minimum width=1cm] {2};
\node (o3) [order, right of=o2, minimum width=3cm, xshift=1cm] {3};
\node (o4) [order, right of=o3, minimum width=1cm, xshift=2cm] {4};

\draw[->] (trade.west) -- (o1.west);
\draw[->] (o1.north) to [out=180] (o2.north);

\end{tikzpicture}

• Can you provide your existing code for us to use it as a template rather than starting from scratch? – percusse Dec 1 '13 at 0:53
• Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Henri Menke Dec 1 '13 at 1:21

I am not doing any work today!

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{positioning}
\tikzset{
blueblock/.style = {draw,rectangle,fill = blue,text=white,align = center,font=\sffamily},
every node/.style = {font=\sffamily}
}

\begin{document}
\begin{tikzpicture}
%% horizontal nodes
\node[anchor=east] at (-0.5,0) {Best bid price};
\node[coordinate] (0) at (-0.5,0) {};
\node[blueblock,minimum width = 1cm,right=.5cm of 0] (1)  {1};
\node[blueblock,minimum width = .5cm,right=.5cm of 1] (2) {2};
\node[blueblock,minimum width = 1.5cm,right=.5cm of 2] (3) {3};
\node[blueblock,minimum width = 1.2cm,right=.5cm of 3] (4) {4};
\node[blueblock,minimum width = .3cm,right=.5cm of 4] (5) {5};
\node[blueblock,minimum width = .6cm,right=.5cm of 5] (6) {6};
\node[blueblock,minimum width = 2.5cm,right=.5cm of 6] (7) {7};
\node[coordinate,right=.5cm of 7] (8) {};
%
\node[draw,fill=red,rectangle,minimum width = 4cm,label=above:Incoming market sell order,anchor=west] (red) at (0,6) {\vphantom{1}};
\node[align=center,text width = 4cm,anchor=south]  at (2.5,4) {Earliest limit order filled completely first};
\node[align=center,text width = 5.5cm]  at (3,2) {Remaining quantity \\ in time order};
\node[align=center,text width = 5.5cm,above = 3cm of 6]  (rest) {Resting limit buy orders \\ of different sizes};
%
\draw[-stealth] ([yshift=-1cm]2.east) -- ([yshift=-1cm]7.west)node[below,pos=0.5] {Time of order submission};
%lines and arrows
\draw[-stealth,shorten >=2pt] (red.south) -| (1.north);
\draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (4.45);
\draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (5.65);
\draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (6);
\foreach \x [remember=\x as \lastx (initially 0)] in {1,...,8}{
\path[draw] (\lastx)--(\x);
}
\foreach \x [remember=\x as \lastx (initially 1)] in {2,...,4}{
\draw (\lastx.65) edge [bend left,-stealth,shorten >=2pt,shorten <=2pt](\x.115);
}
\end{tikzpicture}
\end{document}


• Wow! Thank you so much! That is fantastic. Will be studying this for a while. I wasn't aware of that "right=" node property; makes relative positioning much easier. – griffin Dec 1 '13 at 14:20