# Drawing a series of graphs receding into the page; TikZ

I want to draw a panel of graphs of citation networks receding into the page, as the below sketch demonstrates. In the below sketch, each blue rectangle represents a citation network at a different point in time, drawn as a tikzpicture.

I tried adapting this example of a vertical stack. Interchanging the x- and y-commands on that doesn't produce the right effect and so I though there might be a better way.

I show here how to do it with one cobbled together tikz image (I don't know how to use tikz, so please forgive the incompetence) and use an \includegraphics for the rest. Substitute your code for each \savestack.

\documentclass{article}
\usepackage{graphicx,tikz}
\usepackage[usestackEOL]{stackengine}
\def\incg{\includegraphics[width=.5in]{graph.jpg}}
\begin{document}
% REPLACE \incg IN NEXT LINES WITH YOUR tikz IMAGES
\savestack\layerA{\fboxsep=0pt\fbox{\colorbox{white}{\tiny%
\begin{tikzpicture}
\node [draw] (A) at (0,0) {demo text};
\node [draw] (B) at (0,-.7) {demo text};
\draw (A.215) -- (B.145);
\draw (A.325) -- (B.35);
\end{tikzpicture}}}}
\savestack\layerB{\incg}
\savestack\layerC{\incg}
\savestack\layerD{\incg}
\savestack\layerE{\incg}
\savestack\layerF{\incg}
\savestack\layerG{\incg}
This sets and staggers the boxes.\\
\fbox{\setstackgap{L}{.06in}\Longunderstack[l]{%
\kern.6in\layerG\\
\kern.5in\layerF\\
\kern.4in\layerE\\
\kern.3in\layerD\\
\kern.2in\layerC\\
\kern.1in\layerB\\
\kern.0in\layerA\\
}}

or this\\
\setbox0=\hbox{
\stackinset{r}{.6in}{t}{.36in}{\layerA}{%
\stackinset{r}{.5in}{t}{.30in}{\layerB}{%
\stackinset{r}{.4in}{t}{.24in}{\layerC}{%
\stackinset{r}{.3in}{t}{.18in}{\layerD}{%
\stackinset{r}{.2in}{t}{.12in}{\layerE}{%
\stackinset{r}{.1in}{t}{.06in}{\layerF}{%
\layerG%
}}}}}}
}\fbox{\kern.6in\raisebox{.36in}{\box0}}

\end{document}


• Never knew about the stackengine package. Cool. – mac389 Mar 1 '15 at 1:51

Like this?

\documentclass{article}
\usepackage{tikz}
\tikzset{
box/.style={%
rectangle,
minimum height=4cm,
minimum width=4cm,
bottom color=blue,top color=blue!50
}
}

\begin{document}
\begin{tikzpicture}
\foreach \x in{4,3,2,1}{
\node[box] (c1) at (\x,\x) {};
}
\end{tikzpicture}
\end{document}


• To replace the rectangles with tikzpictures, I would set the node style={draw=none}, and insert a tikzpicture environment inside a minipage as the node text? – mac389 Mar 1 '15 at 1:02

If all you want to do is to stack some tikzpictures, you can avoid nesting tikzpicture environments (which could produce undesired results or force you to previously box the inner environments) by simply using \raiseboxes and some \hspaces:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\noindent
\begin{minipage}{\textwidth}
\centering
\begin{tikzpicture}
\draw[fill=orange!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}%
\hspace*{-30pt}\llap{\raisebox{-0.2\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=cyan!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\hspace*{-30pt}\llap{\raisebox{-0.4\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=magenta!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\hspace*{-30pt}\llap{\raisebox{-0.6\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=olive!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\end{minipage}

\end{document}