1

Can anyone who is well versed in tikz draw help me to include a small inset inside a larger image? (The inset - image 2 - is a "zoomed in" of the smaller inset in image 1 ).

I couldn't do that in tikz, then I tried to do this manually using gimp software (see image below) and lost image quality in the inset (I had to scale the image 2 within a frame I drew and connected two ends (right-north and left-south) to a small inset in image 1. Unfortunately the smaller inset (where the green contours are embedded) in image 1 is not visible because of the color black I used to draw the lines.

enter image description here

Thank you very much!

3

2 Answers 2

2

You can spy on the particular region:

\documentclass{article}
\usepackage{tikz}
   \usetikzlibrary{positioning,spy}

    \begin{document}
    \begin{tikzpicture}
    \begin{scope}[
    node distance = 11mm,
        inner sep = 0pt,spy using outlines={rectangle, red, magnification=6,
 %connect spies
 }
                        ]
\node (n0)  {\includegraphics[width=\textwidth]{example-image-a}};

\spy [blue,size=3cm] on (n0.center) in node[below right=of n0.north west];
\end{scope}
\draw[dashed,blue] (tikzspyonnode.north east) -- (tikzspyinnode.north east);
\draw[dashed,blue] (tikzspyonnode.south west) -- (tikzspyinnode.south west);
    \end{tikzpicture}
    \end{document}

enter image description here

Adjust the size=3cm and magnification=6 values appropriately.

2

When you insert graphics into nodes, then drawing connection between them is easy:

\documentclass{article}
\usepackage{tikz}
   \usetikzlibrary{positioning}
\usepackage{graphicx}

    \begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}[
    node distance = 11mm,
        inner sep = 0pt  
                        ]
\node (n0)  {\includegraphics[width=\textwidth]{example-image}};
\node[at=(n0.center)]    (n1)
            {\includegraphics[width=0.1\textwidth]{example-image-a}};
\node[below right=of n0.north west] (n2)
            {\includegraphics[width=0.3\textwidth]{example-image-b}};
\draw[densely dashed]   (n2.north east) -- (n1.north east)
                        (n2.south west) -- (n1.south west);
    \end{tikzpicture}
    \caption{Galaxy}
\end{figure}
    \end{document}

You just connect by lines between anchors of nodes:

enter image description here

Not the answer you're looking for? Browse other questions tagged .