# How can I have 2 plots side by side such that I can show a line going from one to the other?

Here's a quick visual link to what I want to show,

at 6:09.

I've tried using minipages but that won't allow for a line to go from one plot to the other and here is the code for one of the plots,

\begin{tikzpicture}
\begin{axis}[
ticks=none,
axis lines = middle,
axis line style={->},
ymin=-0.5, ymax = 2.5,
xmin=-0.5, xmax=2.5,
xlabel={$x$},
ylabel={$y$},
axis equal image
]
\draw (axis cs:1.25,1.25) circle [blue, radius=0.5];
\draw[color=blue] (axis cs:1.25,1.25) node[above left] {$a$};
\draw[color=blue] (axis cs:1.25,1.25) node{$\bullet$};
\draw [->] (axis cs:1.25,1.25)  -- node[pos = 0.5, below] {$\delta$} (axis cs:1.75,1.25) ;

\end{axis}
\end{tikzpicture}

• I'll add it sorry. – John Miller Nov 28 '18 at 20:45
• You can have multiple axis environments in the same tikzpicture, placed at different locations with the at key. See for example tex.stackexchange.com/questions/289079/2x2-array-of-pgf-plots/… – Torbjørn T. Nov 28 '18 at 20:58
• In addition to what @TorbjørnT. is saying, you could use remember picture to remember the coordinates in a given picture. You can then access them with overlay,remember picture in a separate picture. – user121799 Nov 28 '18 at 21:08

It is possible to create several axis environments and shift them with xshift. Then, simply draw an arrow from one to the other.

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ticks=none,
axis lines = middle,
axis line style={->},
ymin=-0.5, ymax = 2.5,
xmin=-0.5, xmax=2.5,
xlabel={$x$},
ylabel={$y$},
axis equal image
]
\draw (axis cs:1.25,1.25) circle [blue, radius=0.5];
\draw[color=blue] (axis cs:1.25,1.25) node[above left] {$a$};
\draw[color=blue] (axis cs:1.25,1.25) node (a) {$\bullet$};
\draw [->] (axis cs:1.25,1.25)  -- node[pos = 0.5, below] {$\delta$} (axis cs:1.75,1.25) ;

\end{axis}

\begin{axis}[ xshift=7cm,
ticks=none,
axis lines = middle,
axis line style={->},
ymin=-0.5, ymax = 2.5,
xmin=-0.5, xmax=2.5,
xlabel={$x$},
ylabel={$y$},
axis equal image
]
\draw (axis cs:1.25,1.25) circle [blue, radius=0.5];
\draw[color=blue] (axis cs:1.25,1.25) node[above] {$a$};
\draw[color=blue] (axis cs:1.25,1.25) node(b){$\bullet$};
\draw [->] (axis cs:1.25,1.25)  -- node[pos = 0.5, below] {$\delta$} (axis cs:1.75,1.25) ;

\end{axis}

\draw[->](a)to[bend left](b);
\end{tikzpicture}
\end{document}

• Thank you I did not know of the xshift command before. – John Miller Nov 28 '18 at 21:18
• pgfploots is based on tikz, so it load it , i.e it is necessary to load tikz again. for pgfplots is fine to defined used version. for example after 1.11 you can write coordinates in diagram as (1.25,1.25) . – Zarko Nov 28 '18 at 21:19
• @AndréC while using multiple axis, it is better to use anchor and at as suggested by Stefan in this answer: tex.stackexchange.com/questions/464661/…. – Raaja_is_at_topanswers.xyz Dec 16 '18 at 16:48

In the video it seems that the points also get accessed from outside, which means you might need remember picture anyway.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[remember picture]
\begin{axis}[
ticks=none,
axis lines = middle,
axis line style={->},
ymin=-0.5, ymax = 2.5,
xmin=-0.5, xmax=2.5,
xlabel={$x$},
ylabel={$y$},
axis equal image
]
\draw (axis cs:1.25,1.25) circle [blue, radius=0.5];
\draw[color=blue] (axis cs:1.25,1.25) node[above left] {$a$};
\draw[color=blue] (axis cs:1.25,1.25) node{$\bullet$};
\draw [->] (axis cs:1.25,1.25)  -- node[pos = 0.5, below] {$\delta$} (axis cs:1.75,1.25)
coordinate(d1);
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[remember picture]
\begin{axis}[
ticks=none,
axis lines = middle,
axis line style={->},
ymin=-0.5, ymax = 2.5,
xmin=-0.5, xmax=2.5,
xlabel={$x$},
ylabel={$y$},
axis equal image
]
\draw (axis cs:1.25,1.25) circle [blue, radius=0.5];
\draw[color=blue] (axis cs:1.25,1.25) node[above left] {$a$};
\draw[color=blue] (axis cs:1.25,1.25) node{$\bullet$};
\draw [->] (axis cs:1.25,1.25)  -- node[pos = 0.5, right] {$\delta$}
(axis cs:1.25,0.75) coordinate(d2);
\end{axis}
\end{tikzpicture}
\caption{On the left, our point is on the
\tikzmarknode{D1}{right} while it is on the \tikzmarknode{D2}{bottom} in the
right figure. }
\begin{tikzpicture}[overlay,remember picture]
\draw[red,-latex] (D1) to[out=90,in=-90] (d1);
\draw[red,-latex] (D2) to[out=90,in=-90] (d2);
\draw[red,-latex] (d1) to[out=0,in=180] node[midway,above,sloped,fill=white,fill
opacity=0.6]{has moved}(d2);
\end{tikzpicture}
\end{figure}
\end{document}


• Well I didn't even know you could do this but thank you so much I think this will explain the point I'm trying to make very well. – John Miller Nov 28 '18 at 21:35
• @JohnMiller I think the marmot finally found the crystal ball... Did you asked him? – manooooh Nov 29 '18 at 1:26