99

I am using TikZ to make flowchart kind of diagrams. I want to get a node below and to the left of another node. Please see the following example. I want the replicate the sort of relationship between nodes revealed and WTP measurement. I have done that by creating an empty node directly below WTP measurement and then creating node revealed to the left of it. Is there an easier way? As you see in the code, I tried

   \node [level3, below left=of revealed, node distance=2in] (marketdata) {Market Data};

but that does not work. The node marketdata is not placed below and to the left of node revealed. In fact, it appears above it.

\usemodule[tikz]
\usetikzlibrary[shapes,arrows]

\starttext

% Define block styles
\tikzstyle{level1} = [rectangle, draw, fill=green!40!blue!20, 
    text width=4in, text centered, inner sep=1pt, 
    minimum height=4em]
\tikzstyle{level2} = [rectangle, draw, fill=blue!20, 
    text width=2in, text centered, rounded corners, minimum height=3em]
\tikzstyle{level3} = [rectangle, draw, fill=blue!10, 
    text width=2in, text centered, rounded corners, minimum height=3em]

\starttikzpicture   
   % Place nodes
    \node [level1] (start) {\color[white]{WTP measurement}};
    \node [below of = start, node distance=1in] (blank) { };
    \node [level2, right of = blank, node distance=2in] (stated) {Stated Preference};
    \node [level2, left of = blank, node distance=2in] (revealed) {Revealed Preference};
    \node [level3, below left=of revealed, node distance=2in] (marketdata) {Market Data};


    % Draw edges
    \path [line] (start) -- (stated);
    \path [line] (start) -- (revealed);    
\stoptikzpicture

\stoptext
Martin Scharrer
  • 262,582
  • Welcome to TeX.SX. We prefer not to have any opening or closing text. As long the issue or solution is not ConTeXt specific the question should not be tagged with {context}. – Martin Scharrer Apr 20 '11 at 10:56

2 Answers2

112

You need the positioning library loaded to use the relative positioning commands. And once you load it, below left=of should work fine.

\documentclass[border=1in]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \node (a) {A};
  \node [below left=of a] {B};
\end{tikzpicture}
\end{document}

below left works

Seamus
  • 73,242
71

Building on @Seamus' answer and @Martin Scharrer's comment, try this:

\documentclass[border=1in]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \node (a) {A};
  \node [below left=1cm and 3cm of a] {B}; % Note the way the distances are specified
\end{tikzpicture}
\end{document}