# Anchor a node in the corner of a tikzpicture

How can I position a node in, say, the top-left corner of the tikzpicture without setting the position explicitly?

Are there any hooks for positioning relative to the tikzpicture "frame" itself (and that will work in the general case)?

-

The current bounding box node is just that, a node encompassing the content of the tikzpicture at that point. Hence, current bounding box.north west is the top left corner. The bounding box may of course change if you add new elements to the diagram.

A quick example:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\node [draw,below right] at (current bounding box.north west) {top left};
\draw [red] (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{document}


-
Great thanks! Pro-tips for anyone as dumb as me: make sure to put the node anchored on the bounding box only after the bounding box won't change: e.g., after everything else. :) –  badroit Aug 14 '14 at 20:02