I successfully used the answer to Beamer overlays, tikz external and custom file name in my presentation. However the proposed solution does just seem to work for \only. When I use \uncover I get a weird behavior:
- 1st slide: Graph 4 is uncovered
- 2nd slide: Graph 1 and 4 is uncovered
- 3rd slide: Graph 2 and 4 is uncovered
- 4th slide: Graph 3 and 4 is uncovered
Though I obviously would expect:
- 1st slide: Graph 1 is uncovered
- 2nd slide: Graph 2 is uncovered
- 3rd slide: Graph 3 is uncovered
- 4th slide: Graph 4 is uncovered
What is the reason for this behaviour and how can I fix that? For \only everything works as expected.
MWE
\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{external}
\makeatletter
\newcommand*{\overlaynumber}{\number\beamer@slideinframe}
\tikzset{
beamer externalizing/.style={%
execute at end picture={%
\tikzifexternalizing{%
\ifbeamer@anotherslide
\pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}%
\fi
}{}%
}%
},
external/optimize=false
}
\let\orig@tikzsetnextfilename=\tikzsetnextfilename
\renewcommand\tikzsetnextfilename[1]{\orig@tikzsetnextfilename{#1-\overlaynumber}}
\makeatother
\tikzset{every picture/.style={beamer externalizing}}
\tikzexternalize
\setbeamercovered{transparent}
\begin{document}
\begin{frame}
\tikzsetnextfilename{figure}
\begin{tikzpicture}[shorten >=4pt,shorten <=4pt]
\begin{groupplot}[group style={group size=2 by 2},
height=3.5cm,width=3.5cm,/tikz/font=\small]
\uncover<1>{\nextgroupplot%1
\addplot coordinates {(0,1) (1,0)};
\node at (rel axis cs:{0.5,0.5}) {1};
}
\uncover<2>{
\nextgroupplot%2
\addplot coordinates {(0,1) (1,0)};
\node at (rel axis cs:{0.5,0.5}) {2};
}
\uncover<3>{
\nextgroupplot%3
\addplot coordinates {(0,1) (1,0)};
\node at (rel axis cs:{0.5,0.5}) {3};
}
\uncover<4>{
\nextgroupplot%4
\addplot coordinates {(0,1) (1,0)};
\node at (rel axis cs:{0.5,0.5}) {4};
}
\end{groupplot}
\end{tikzpicture}
\end{frame}
\end{document}
I compile with
lualatex.exe -synctex=1 -interaction=nonstopmode -enable-write18 %.tex
in TexStudion on Miktex 2.9.

