有一个与此处(几乎)最小示例类似的情节:
\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}
是否可以使用投影仪叠加技术一次一个地发现单个样本?
答案1
不使用任何库的版本,仅\pause
通过添加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}
答案2
您可以使用该overlay-beamer-styles
库:
\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}