[Tex/LaTex] Merge two TikZ pictures into one

combinegnuplottikz-pgf

Is it possible to merge two existing TikZ pictures into one?
I have two pictures of this type and want to set them beneath each other in one tikzpicture environment (and adding some arrows between both pictures) without editing all the coordinates :

  \begin{tikzpicture}[domain=0:2.1, smooth, scale=0.8]
  \draw[->] (0,0) -- (4.2,0);
  \draw[->] (0,0) -- (0,3.2);
  \draw[] (1,0) -- (1,-0.15) node[below] {$\alpha_0$};
  \draw[color=red,thick,samples=500] plot (\x,{3*exp(-5*(\x-1)^2});
  \draw[color=blue,dashed,thick,samples=500] plot (\x,{3*exp(-5*(\x-1)^2});
  \end{tikzpicture}

Is there an easy way to do that?

Best Answer

You can simply include both your TikZ pictures into one by placing them inside nodes of yet another TikZ picture. As long as you don't seriously have to worry about compilation time it is OK to write something like the code below.
It also helps with the arrows in between.

\documentclass{article}

\usepackage{tikz}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}

    \begin{tikzpicture}
       \node (a) at (0,0)
         {
            \begin{tikzpicture}
               \draw (0,0) circle (1cm);
            \end{tikzpicture}
         };
        \node (b) at (a.south) [anchor=north,yshift=-1cm]
         {
            \tikz\fill[blue] (0,0) circle (0.7cm);
         };
       \draw [<->] (a)--(b);
    \end{tikzpicture}

\end{document}

Result of the example code

Related Question