1

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:

enter image description here

  • 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.

1 Answer 1

1

The solution for tikz-cd by Gonzalo Medina also applies for and .

In the preamble:

\tikzset{
    invisible/.style={opacity=0.2},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
        \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}%
    }
}

In the document:

\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]

            \nextgroupplot[visible on=<1>]%1
            \addplot coordinates {(0,1) (1,0)};
            \node at (rel axis cs:{0.5,0.5}) {1};

            \nextgroupplot[visible on=<2>]%2
            \addplot coordinates {(0,1) (1,0)};
            \node at (rel axis cs:{0.5,0.5}) {2};

            \nextgroupplot[visible on=<3>]%3
            \addplot coordinates {(0,1) (1,0)};
            \node at (rel axis cs:{0.5,0.5}) {3};

            \nextgroupplot[visible on=<4>]%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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .