I was writing on an document with a lot of pgfplots in it. Because of the memory limitation in LaTeX and in order to save some compiling time I tried out the externalize command. With most of the plots it perfectly worked out. But when I use the \ref command, namely \ref{<legendname>} the legend gets lost and instead there is a ??.
I think this question in a way is similar to Referencing externalized pgfplots with subfig and cleverref and Using reference with externalized pgfplot figure. But no answer to these questions could solve my problem. Even the use of xr and zref packages showed no effect.
Am I just missing something?
MWE of the maindocument:
\documentclass{article}
\usepackage{zref-user}
\usepackage{xr-hyper}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\usepgfplotslibrary{external}
\tikzexternalize
\externaldocument{part1}
\begin{document}
\input{part1}
\end{document}
With part1.tex looking like this:
\begin{tikzpicture}
\begin{groupplot}[
group style= { columns=3,xlabels at=edge bottom,
y descriptions at=edge left,
horizontal sep=2cm,group name=plots},
width=0.4\textwidth,
xtick=data,
legend columns=3]
\nextgroupplot[xlabel=site 1,legend to name=grouplegend]
\addplot coordinates {(1,20)(2,23)(3,24.5)};
\addlegendentry {AaAaA,BbBbB,CcCcC}%
\nextgroupplot[xlabel=site 2]
\addplot coordinates {(1,14)(2,16)(3,17)};
\nextgroupplot[xlabel=site 3]
\addplot coordinates {(1,10)(2,11.5)(3,12.25)};
\end{groupplot}
% Legend
\node at (plots c2r1.north) [anchor=south] {\ref{grouplegend}};
\end{tikzpicture}
I'm writing with MikTeX 2.9 and the latest updates of the packages used.
For compiling I used the command pdflatex -enable-write18 <file name>.
I hope the MWE is short enough ;) and some knows how to solve this problem.
\label{grouplegend}, so it doesn't know what to reference to. Or am I missing something? – Psirus Jan 10 '12 at 16:03legend to name=grouplegend– nickpapior Jan 10 '12 at 18:20