# Superimpose two plots with tikZ or pgf [duplicate]

The net effect should be the following Basically, it is a zoom, except I don’t want to actually magnify a portion of a graph, but putting another more detailed one instead.

Note: If you need more inner nodes you could use two scopes.

### Code

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\node[draw, dashed, ellipse, minimum width=40mm, minimum height=30mm, anchor=south west] (plot1) at (0,0) {plot 1};
\node[draw, minimum width=10mm, minimum height=7mm, x={(plot1.south east)}, y={(plot1.north west)}] (hlbox) at (.9,.7) {};
\node[draw, minimum width=30mm, minimum height=20mm, above right=of plot1, xshift=10mm] (plot2) {plot 2};
\draw[->] (plot2.south west) -- (hlbox.north east);
\end{tikzpicture}

\end{document}

• Thanks. One last thing: when I add \foreach \x in {1,...,300}{--++(0.03,{0.1*(floor(rand)*2.0+1.0)*sqrt(-ln(1-rand^2)/0.627)})} in place of {plot 1} pdflatex doesn't compile. Why? Jan 23 at 10:12
• You should ask a new question for unrelated stuff. {plot 1} is the text content of the node. You can't put tikz commands in there. Jan 23 at 10:38