\documentclass{standalone}
\input{palette}
\usepackage{pgfplots}
\pgfplotsset{compat=default}
% With this compatability setting, pgfplots runs in backwards compatability mode using pgfplots version pre-1.3. It's safe to use a more current version, but axis and tick labels may move and need to be repositioned.

%\usepackage{txfonts}
%\usepackage[mathscr]{euscript}
% The above font packages were used to generate figures for the article, but are here commented out to ensure better compability.

\usetikzlibrary{pgfplots.groupplots}

\newcommand{\mytick}[2]{\draw[thick,#2] (#1, 0.01) -- (#1, -0.15);}

\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
    group style={
        group name=my plots,
        group size=1 by 3,
        xlabels at=edge bottom,
        xticklabels at=edge bottom,
        vertical sep=0pt
    },
    width=.9\textwidth,
    height=0.3\textwidth,
    xlabel=$h_x/J$,
    xlabel style={yshift=.2cm},
    xmin=0,
    xmax=2.75,
    ymin=0,
    xticklabel style = {/pgf/number format/fixed, /pgf/number format/zerofill, /pgf/number format/precision=1,
    yshift=.08cm},
    xtick = {0.0, 0.2, 0.4, ..., 2.4},
    yticklabel style = {/pgf/number format/fixed, /pgf/number format/zerofill, /pgf/number format/precision=1},
    tickpos=left,
    ytick align=outside,
    xtick align=outside
]

\nextgroupplot[height=0.235\textwidth, 
yticklabels = {}, ytick style = {white}, xtick style = {white}, title = {(a)}, title style = {at = {(axis description cs:0.97,0.44)}}]

\nextgroupplot[ylabel=Gap (meV), ytick = {0.1, 0.3, 0.5, ..., 0.8},ymax=.9,legend style = {anchor = south east,at={(axis description cs: 1, 0.2)}},
title = {(b)}, title style = {at = {(axis description cs:0.97,0.63)}}, ylabel style = {yshift=-0.2cm}]
\addplot [draw = virmiddle, color = virmiddle, mark=*, dashed, mark options={solid}] table [x=<h>, y=Delta1, col sep=space, y expr = \thisrowno{5}/(0.23)] {DMRG_Data/Delta025_Gaps_h_L100_mixedm.dat};
\addplot[fill= white, draw = virdark, mark=*, dashed, mark options={solid}] table [x=<h>, y=Delta2, col sep=space, y expr = \thisrowno{6}/(0.23)] {DMRG_Data/Delta025_Gaps_h_L100_mixedm.dat};
\legend{\textcolor{virmiddle}{$\Delta E_1$}, \textcolor{virdark}{$\Delta E_2$}};
\nextgroupplot[legend style = {anchor = south east,at={(axis description cs: 1, 0.2)}}, ylabel=Order parameter, ytick={0.0, 0.1, 0.2, ...,0.5},
ylabel style={xshift=-.1cm},%xshift to shift it down... Makes no sense.
title = {(c)}, title style = {at = {(axis description cs:0.97,0.63)}}, xlabel style = {at = {(axis description cs: 0.96,0.13)}},
ylabel style = {yshift=-0.2cm}]
% Magnetization m^x along \hat{x}.
% Plotted using Magnetization_Delta025_h.dat, generated using ground state runs, which has more field values than StaggeredMagnetization_h_mixedm.dat, the data of which was generated using excited state runs.
\addplot[virmiddle, mark=*, dashed, mark options={solid}] table [x=<h>, y=<Mx>, col sep=space, y expr = \thisrowno{2}*(-1)] {DMRG_Data/Magnetization_Delta025_h.dat};
% Staggered magnetization m^y_\mathrm{st} along \hat{y}.
\addplot[fill= white, draw = virdark, mark=*, dashed, mark options={solid}] table [x=<h>, y=<MySt>, col sep=space, y expr = abs(\thisrowno{6})] {DMRG_Data/StaggeredMagnetization_h_mixedm.dat};
 \legend{\textcolor{virmiddle}{$m^x$}, \textcolor{virdark}{$m^y_\mathrm{st}$}};
\end{groupplot}
\def\yy{-0.2}
\def\xcrit{5.2}
\def\xclas{4.8}
\foreach \x in {0, ..., 7}{
	\def\xx{0.4*\x+1.2}
	\ifodd\x{\draw[->,virmiddle,thick] (\xx-0.1, 0.1) -- (\xx, 0.55);}\else{\draw[->,virmiddle,thick] (\xx, 0.1) -- (\xx-0.1, 0.55);}\fi       	
}
\foreach \x in {0, ..., 7}{
	\def\xx{0.4*\x+\xcrit+0.5}\draw[->,virdark,thick] (\xx, 0.1) -- (\xx, 0.55);
	
}

\node[virmiddle] at (\xcrit - 2.7,-3.75*\yy) {\textbf{spin-flop phase}};
\node[virdark] at (\xcrit + 2.0,-3.75*\yy) {\textbf{spin-polarized phase}};
\node[viryellowdark] at (0.12,-\yy) {$0$};
\node at (\xclas,-\yy) {$h_\mathrm{f}$};
\node[viryellowdark] at (\xcrit,-\yy) {$h_\mathrm{c}$};
\node at (8.9, -\yy) {$h_x$};
\draw[->,thick,virdark] (0,0) -- (9.3, 0);
\draw[-,thick,virmiddle] (0,0) -- (\xcrit, 0);

\mytick{0}{viryellowdark};
\mytick{\xclas}{black};
\mytick{\xcrit}{viryellowdark};
\node[viryellowdark] (c1) at (0.7, 1.05) {$c=1$\textcolor{white}{$/$}};
\node[viryellowdark] (c12) at (\xcrit - 0.5, 1.05) {$c=1/2$};
\draw[draw=viryellowdark] (c1.west) -- (c1.south west) -- (c1.south east) -- (c1.east);
\coordinate (A) at (0.24, 0.20);
\coordinate (B) at (\xcrit, 0.36);
\coordinate (C) at (c12.east -| B);
\coordinate (D) at (c1.south |- A);
\draw [->,viryellowdark] (c1.south) -- (D) -- (A);
\draw [viryellowdark] (c12.west) -- (c12.south west) --(c12.south east) -- (c12.east);
\draw [->,viryellowdark] (c12.south-|B) -- (B);
\end{tikzpicture}

\end{document}


