2

have a a plot that is similar to this (almost) minimal example here:

\documentclass{beamer}

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{frame}
    \begin{tikzpicture}
        \begin{axis}[
            axis x line = bottom,
            axis y line = left,
            ]

            \addplot3[
                samples at = {1.3, 2, 2.55, 3.5, 5.7, 12},
                samples y =0,
                point meta=(x-0.5)^2 + y^2,
                mark = *,
                only marks,
                scatter,
                ]
                ({sin(x)}, {cos(x)}, {1/x});
        \end{axis}
    \end{tikzpicture}
\end{frame}
\end{document}

Is it possible to uncover the single samples one at a time with beamer overlays?

2 Answers 2

4

A version not using any library, just adding \pause via scatter/@post marker code:

\documentclass{beamer}

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{frame}
    \begin{tikzpicture}
        \begin{axis}[
            axis x line = bottom,
            axis y line = left,
            scatter/@pre marker code/.code={},
            scatter/@post marker code/.code={\pause}
            ]

            \addplot3[
                samples at = {1.3, 2, 2.55, 3.5, 5.7, 12},
                samples y =0,
                point meta=(x-0.5)^2 + y^2,
                mark =*,
                only marks,
                scatter,
                ]
                ({sin(x)}, {cos(x)}, {1/x});
        \end{axis}
     \onslide<1->% see comments
    \end{tikzpicture}
\end{frame}
\end{document}
10
  • You are a mighty magician, you can make footlines disappear :) Try e.g. with \usetheme{Boadilla} Aug 7, 2022 at 13:34
  • @samcarter_is_at_topanswers.xyz I was just happy to get the \pause injected. (Is this salvageable, or should I delete?) Aug 7, 2022 at 13:53
  • I know the feeling :) You can add a \onslide<1-> before the end of the tikzpicture. Aug 7, 2022 at 13:55
  • @samcarter_is_at_topanswers.xyz thanks Aug 7, 2022 at 13:59
  • You're welcome! Aug 7, 2022 at 13:59
3

You can use the overlay-beamer-styles library:

\documentclass{beamer}

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{overlay-beamer-styles}

\begin{document}
\begin{frame}
    \begin{tikzpicture}
        \begin{axis}[
            axis x line = bottom,
            axis y line = left,
            ]

            \addplot3[
                samples at = {1.3, 2, 2.55, 3.5, 5.7,12},
                samples y =0,
                point meta=(x-0.5)^2 + y^2,
                mark = *,
                only marks,
                scatter,
                scatter src=z,
                scatter/use mapped color={draw=mapped
                color!80!black,fill=mapped color,visible on=<+->}
            ]
                ({sin(x)}, {cos(x)}, {1/x});
        \end{axis}
    \end{tikzpicture}
\end{frame}
\end{document}

enter image description here

8
  • Haha. You gave the hint with overlay-beamer-styles just two days ago in another post of mine. I didn't see how I could use it here. Ty.
    – Franz
    Aug 7, 2022 at 11:42
  • @Franz You're welcome! Aug 7, 2022 at 11:43
  • Where can I actually find the documentation for tikz libraries? I tried to search for "CTAN overlay-beamer-styles" but did not find anything useful. The tikz/pgfplots documentation also does not mention it.
    – Franz
    Aug 7, 2022 at 19:16
  • @Franz ctan.org/pkg/aobs-tikz Aug 7, 2022 at 19:18
  • Ok. The name was so obscure that I didn't recognized it as overlay-beamer-styles. The documentation and the features also seem kind of sparse, e.g., I was looking for an alert on= command but could find it.
    – Franz
    Aug 8, 2022 at 0:07

You must log in to answer this question.

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