# Placing two axis environments relative to each other in TikZ figure [closed]

I am currently making a TikZ figure containing both standard lines using \draw and two different plots, each in their own axis environment. I want to place them all together with the plots placed diagonally relative to each other, as shown in the figure below

The above figure has been generated using the following code using ShareLaTeX, along with packages tikz with and pgfplots with

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{calc}

\usepackage[active,floats,tightpage]{preview}
\setlength\PreviewBorder{1em}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}

% =================== Binding energy graph ========================

\node [anchor=south west] (nodeEb) at (-0.1,-0.1){};

\node [anchor=south west] (DOS) at (2.2,-0.5){};

\begin{axis}
[  % graph position
at={(nodeEb)},
ticks = none,
set layers,
axis on top,
axis line style = thick,
width=7.5cm,
height=7cm,
axis lines=center,
domain=0:5,
samples=100,
xmin=0, xmax=3,
ymin=0, ymax=8,
xlabel style={at={(DOS)},anchor=west},
y label style={at={(axis description cs:-0.1,0.3)},anchor=south},
xlabel={DOS},
ylabel={$E_{B}$}
]

% Fermi energy

% Fill under Fermi
\path[name path=axis] (axis cs:0,3.9) -- (axis cs:0,5.9);
fill between[of=fermi and axis,];
\end{axis}

\draw [thick,teal] (0,0.5) -- (4,0.5); % Core energy top
\draw [thick,teal] (0,1.4) -- (3,1.4); % Core energy bottom
\draw [thick,teal] (0.05,0) -- (0.05,3); % Baseline

% ======== Kinetic energy graph =========

\node [anchor=south west] (nodeEk) at (5.7,4.4){}; % Node plot E_k

% Axis label nodes
\node (Int) at (7.5,4.22) {};
\node (Ek) at (5.8,10){};

% Ek plot
\begin{axis}
[
at={(nodeEk)},
ticks = none,
set layers,
axis on top,
axis line style = thick,
width=5.5cm,
height=7cm,
axis lines=center,
domain=0:5,
samples=100,
xmin=0, xmax=3,
ymin=0, ymax=8,
xlabel style={at={(Int)},anchor=west},
ylabel style={at={(Ek)},anchor=west},
xlabel={Intensity},
ylabel={$E_{K}$}
]

% core signals

% Fermi energy

% Fill under Fermi
\path[name path=axis] (axis cs:0,3.9) -- (axis cs:0,10);
fill between[of=fermi and axis,];
\end{axis}

% ======== Supporting lines ==============
\draw [thick,dashed] (3.1,1.4) -- (9.8,1.4); % Upper core level Eb

\draw [thick,dashed] (0,4) -- (8,4); % Fermi energy Eb
\draw [thick] (0,5) -- (3.5,5) -- (5.8,4.53); % E_{Vac}
\draw [thick,dashed] (8.9,5.9) -- (9.8,5.9); % Upper core level Ek
\draw [thick,dashed] (5.9,8.55) -- (9.8,8.55); % Fermi energy Ek

% ======== Arrows =========================

\draw[thick,<->] (2.2,4.1)--(2.2,4.9); % Surface work function
\draw [thick,<->] (5.9,4.1) -- (5.9,4.4); % Analyzer work function
\draw[thick,->] (-0.5,1.7)--(-0.5,0.7); % Binding energy arrow
\draw [violet,very thick, decorate, decoration={snake}, ->] (9.2,1.5)--(9.2,5.7); % Photon

% =========== Text ========================

\node at (2.5,4.5){$\Phi_{S}$}; % Surface work function
\node at (6.3,4.22){$\Phi_{A}$}; % Analyzer work function
\node at (-0.5,4){$E_{F}$}; % E_F Binding energy graph
\node at (-0.5,5){$E_{V}$}; % Vacuum energy level
\node at (5.4,8.55){$E_{F}$}; % E_F Kinetic energy graph
\node at (2.3,3.4){Valence band}; % Valence band
\node at (4.2,1){Core levels}; % Core levels
\node at (8.5,2.8){\large $h\nu$}; % Photon
\node at (2.1,6){\Large \textbf{Sample}}; % Sample text
\node at (8,9.5){\Large \textbf{Analyzer}}; % Analyzer text

\end{tikzpicture}
\caption{Photoemission process}
\label{fig:photoemission}
\end{figure}
\end{document}


My problem is: as I change environment to using MacTeX and Sublime Text 3, the secong graph (Analyzer) insists on being placed at the same origin as the first graph. in other words, the at={(nodeEk)} does not seem to work.

Does anyone have a solution to how to place two axis plots displaced relative to each other in the same TikZ figure?

Any help is kindly appreciated!

## closed as off-topic by user156344, Raaja, Stefan Pinnow, Mensch, Phelype OleinikMar 4 at 12:09

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I pasted your code and it works just fine (code, screenshot) using TeXlive 2017 on Linux. – Henri Menke Dec 11 '17 at 10:00
• your code also works fine with miktex, recent version. – Zarko Dec 11 '17 at 13:38
• I note that your MacTeX is a couple of years old, and that you appear to have TikZ version 3.0.0 and pgfplots version 1.12. The latest stable versions are 3.0.1a and 1.15, respectively. It could be that whatever the problem is has been fixed in later versions, so that upgrading will fix it. – Torbjørn T. Jan 3 '18 at 16:25
• Updating to MacTeX 2017 fixed it! Thanks – Haakon Rost Jan 8 '18 at 14:13
• I'm voting to close this question as off-topic because the cause is: the OP's TeX distribution is out-of-date. – user156344 Mar 4 at 10:12