3

Wondering how to draw an arrow between two large drawings inside of a single figure, essentially like this:

enter image description here

Where that "physical line graph" arrow is, between the two boxes. They aren't nodes, they are full objects. I tried using tikzcd package with \arrow{r} but wasn't able to get it working inside of a tikzpicture.

Here is a MWE document demonstrating the desired behavior (but it doesn't compile unless the first block is commented out):

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tikz-cd}

\begin{document}

%
% Better example, but doesn't compile.
%

\begin{tikzpicture}
  \begin{tikzcd}
    \begin{scope}
      \draw[xshift=3cm] (0,0) node[anchor=north]{$A$}
        -- (4,0) node[anchor=north]{$C$}
        -- (4,4) node[anchor=south]{$B$}
        -- cycle;
    \end{scope}

    \arrow[r]

    \begin{scope}
      \draw[xshift=-3cm] (0,0) node[anchor=north]{$A$}
        -- (4,0) node[anchor=north]{$C$}
        -- (4,4) node[anchor=south]{$B$}
        -- cycle;
    \end{scope}
  \end{tikzcd}
\end{tikzpicture}

%
% Negative example, but does compile.
%

\begin{figure}
\centering
  \begin{tikzpicture}
    \begin{scope}
      \draw[xshift=3cm] (0,0) node[anchor=north]{$A$}
        -- (4,0) node[anchor=north]{$C$}
        -- (4,4) node[anchor=south]{$B$}
        -- cycle;
    \end{scope}

    $\rightarrow$

    \begin{scope}
      \draw[xshift=-3cm] (0,0) node[anchor=north]{$A$}
        -- (4,0) node[anchor=north]{$C$}
        -- (4,4) node[anchor=south]{$B$}
        -- cycle;
    \end{scope}
  \end{tikzpicture}
\end{figure}

\end{document}
4
+50

I also think that your question has already been answered in the answers mentioned by @CarLaTeX. However, in what follows I collect 4 different standard situations you may encounter, hoping that this may allow you to achieve what you want.

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{subfig}
\begin{document}
\section*{Case 1: external graphics}

\subsection*{Case 1a: subfloats}

\begin{figure}[h!]
\centering
\subfloat{\tikz[remember
picture]{\node(1AL){\includegraphics[width=4cm]{example-image-a}};}}%
\hspace*{3cm}%
\subfloat{\tikz[remember picture]{\node(1AR){\includegraphics[width=4cm]{example-image-b}};}}
\end{figure}
\tikz[overlay,remember picture]{\draw[-latex,thick] (1AL) -- (1AL-|1AR.west)
node[midway,below,text width=2.5cm]{Physical Line Graph Transformation};} 

\subsection*{Case 1b: no subfloats}

\begin{figure}[h!]
\centering
\tikz[remember
picture]{\node(1BL){\includegraphics[width=4cm]{example-image-a}};}%
\hspace*{3cm}%
\tikz[remember picture]{\node(1BR){\includegraphics[width=4cm]{example-image-b}};}
\end{figure}
\tikz[overlay,remember picture]{\draw[-latex,thick] (1BL) -- (1BL-|1BR.west)
node[midway,below,text width=2.5cm]{Physical Line Graph Transformation};} 

\clearpage

\section*{Case 2: no external graphics}

\subsection*{Case 2a: subfloats}

\begin{figure}[h!]
\centering
\subfloat[postion=top][]{\begin{tikzpicture}[remember picture,every
node/.style={draw,circle,fill=blue,minimum width=4pt}]
\node[label=135:C1] (C1) {};
\node[below=0.7cm of C1,label=135:C2] (C2){};
\node[right=0.8cm of C1,label=45:C3] (C3){};
\node[right=0.8cm of C2,label=45:C4] (C4){};
\node[below=0.7cm of C4,label=-45:C5] (C5){};
\node[right=0.8cm of C4,label=-90:C6] (C6){};
\draw (C4) -- (C5) -- (C6) -- (C2) -- (C3) -- (C1) -- (C2) -- (C4) -- (C1) --
(C3) -- (C4);
\node[draw=none,fill=none,rectangle,above=0.5cm of C1,xshift=-1cm,anchor=south west]{Substrate Graph G};
\path (current bounding box.north east) -- 
(current bounding box.south east) coordinate[midway] (2AL);
\end{tikzpicture}}
\hspace*{3cm}%
\subfloat[postion=top][]{\begin{tikzpicture}[remember picture,every
node/.style={draw,circle,fill=red,minimum width=4pt}]
\node[label=-90:R1] (R1) {};
\node[below=0.7cm of R1,xshift=2cm,label=135:R2] (R2){};
\node[draw=none,fill=none,rectangle,above=0.5cm of R1,xshift=-1cm,anchor=south
west]{Reaction Graph $L_\mathrm{real}(G)$};
\coordinate[below=2.5cm of R1] (X);
\draw[white](X)--++(1cm,0);
\path (current bounding box.north west) -- 
(current bounding box.south west) coordinate[midway] (2AR);
\end{tikzpicture}}
\end{figure}
\tikz[overlay,remember picture]{\draw[-latex,thick] (2AL) -- (2AL-|2AR)
node[midway,below,text width=2.5cm]{Physical Line Graph Transformation};} 

\subsection*{Case 2b: no subfloats}

\begin{figure}[h!]
\centering
\begin{tikzpicture}[remember picture,every
node/.style={draw,circle,fill=blue,minimum width=4pt}]
\node[label=135:C1] (C1) {};
\node[below=0.7cm of C1,label=135:C2] (C2){};
\node[right=0.8cm of C1,label=45:C3] (C3){};
\node[right=0.8cm of C2,label=45:C4] (C4){};
\node[below=0.7cm of C4,label=-45:C5] (C5){};
\node[right=0.8cm of C4,label=-90:C6] (C6){};
\draw (C4) -- (C5) -- (C6) -- (C2) -- (C3) -- (C1) -- (C2) -- (C4) -- (C1) --
(C3) -- (C4);
\node[draw=none,fill=none,rectangle,above=0.5cm of C1,xshift=-1cm,anchor=south west]{Substrate Graph G};
\path (current bounding box.north east) -- 
(current bounding box.south east) coordinate[midway] (2BL);
\end{tikzpicture}
\hspace*{3cm}%
\begin{tikzpicture}[remember picture,every
node/.style={draw,circle,fill=red,minimum width=4pt}]
\node[label=-90:R1] (R1) {};
\node[below=0.7cm of R1,xshift=2cm,label=135:R2] (R2){};
\node[draw=none,fill=none,rectangle,above=0.5cm of R1,xshift=-1cm,anchor=south
west]{Reaction Graph $L_\mathrm{real}(G)$};
\coordinate[below=2.5cm of R1] (X);
\draw[white](X)--++(1cm,0);
\path (current bounding box.north west) -- 
(current bounding box.south west) coordinate[midway] (2BR);
\end{tikzpicture}
\end{figure}
\tikz[overlay,remember picture]{\draw[-latex,thick] (2BL) -- (2BL-|2BR)
node[midway,below,text width=2.5cm]{Physical Line Graph Transformation};} 



\end{document}

enter image description here

ADDENDUM: Scopes.

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\begin{document}

\section*{Case 3: scopes}

\begin{tikzpicture}
\begin{scope}[every node/.style={draw,circle,fill=blue,minimum width=4pt}]
\node[label=135:C1] (C1) {};
\node[below=0.7cm of C1,label=135:C2] (C2){};
\node[right=0.8cm of C1,label=45:C3] (C3){};
\node[right=0.8cm of C2,label=45:C4] (C4){};
\node[below=0.7cm of C4,label={[name=C5label]-45:C5}] (C5){};
\node[right=0.8cm of C4,label={[name=C6label]-90:C6}] (C6){};
\draw (C4) -- (C5) -- (C6) -- (C2) -- (C3) -- (C1) -- (C2) -- (C4) -- (C1) --
(C3) -- (C4);
\node[draw=none,fill=none,rectangle,above=0.5cm of C1,xshift=-1cm,anchor=south west]
(Substrate){Substrate Graph G};
\end{scope}
\node[draw,fit=(Substrate) (C5label) (C6label)] (LeftScope){};
\begin{scope}[xshift=7cm,yshift=-1cm,every
node/.style={draw,circle,fill=red,minimum width=4pt}]
\node[label=-90:R1] (R1) {};
\node[below=0.7cm of R1,xshift=2cm,label=135:R2] (R2){};
\node[draw=none,fill=none,rectangle,above=0.5cm of R1,xshift=-1cm,anchor=south
west](Reaction){Reaction Graph $L_\mathrm{real}(G)$};
\coordinate[below=2.5cm of R1] (X);
\draw[white](X)--++(1cm,0);
\path (current bounding box.north west) -- 
(current bounding box.south west) coordinate[midway] (2AR);
\end{scope}
\node[draw,fit=(Reaction) (R1) (R2)] (RightScope){};
\draw[-latex,thick] (LeftScope) -- (LeftScope-|RightScope.west)
node[midway,below,text width=2.5cm]{Physical Line Graph Transformation};
\end{tikzpicture}
\end{document}

enter image description here

  • So it looks like you can't draw it between two scopes then :/ – Lance Pollard Mar 24 '18 at 19:46
  • @LancePollard Of course you can. Which scopes are you talking about? – marmot Mar 24 '18 at 21:40
  • Oh nice, the one in the example drawing I posted above, I tried grouping them into scopes and draw arrows between the scopes but couldn't figure it out. – Lance Pollard Mar 24 '18 at 22:42
  • 1
    @LancePollard I added an example for scopes. Since the output did not resemble too much your first picture, I used a TikZ picture that is a bit more similar. Please let me know if you need adjustments. – marmot Mar 24 '18 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.