我有几条曲线需要展示,并且想在同一张幻灯片上以项目符号列表同步展示它们。
这个列表很好,但是不同的曲线并不按照我想要的顺序排列,即使我切换了顺序。
如何继续?非常感谢以下代码:
\documentclass{beamer}
% packages
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
% customisations
\def \calR{\mathcal{R}}
\definecolor{grayTelecom}{RGB}{188,189,188}
\definecolor{redTelecom}{RGB}{191,18,56}
\mode<presentation>{}
\begin{document}
\begin{frame}{Introduction: C-PPE and digital Dispersion Pre-Distortion (DPD)}
\begin{tikzpicture}[scale = 0.6]
\begin{axis}[
height = 10cm,
width = 10cm,
xlabel = {\Large $z$},
ylabel = {\Large Correlation profiles~(a.u.)},
xtick = {0,100,200,300,400,500},
ymin = 0.988,
ymax = 0.9942,
x tick label style = {font = \Large},
y tick label style = {font = \Large},
y tick label style={
/pgf/number format/precision=4
},
legend style = {draw=none, legend columns = 2, legend pos = north west, font = \Large},
legend entries = {$R$,$R^{(pd=5100)}$,$\calR$,$\calR^{(pd=5100)}$},
]
{\visible<1->{
\addplot [mark = none, color = gray] coordinates {
(0, 0.9901)
(100, 0.9882)
(100, 0.9901)
(200, 0.9882)
(200, 0.9901)
(300, 0.9882)
(300, 0.9901)
(400, 0.9882)
(400, 0.9901)
(500, 0.9882)
};}}
% {\visible<1->{
% addplot[
% line width = 2pt,
% color = black,
% ]
% table[x=d, y=PP17, col sep= comma]
% {./Figures/PPE/PPE_17_5100_5spans.txt} ;}}
{\visible<1->{
\addplot [mark = *, mark size = 4pt, dashdotted, color = black] coordinates {
(7, 0.99175)
(107, 0.99245)
(207, 0.99260)
(307, 0.99265)
(407, 0.99270)
};}}
{\visible<1->{
\addplot [mark = *, mark size = 4pt, dashdotted, color = black] coordinates {
(67, 0.99117)
(167, 0.99142)
(267, 0.99152)
(367, 0.99156)
};}}
% {\visible<2->{
% \addplot[
% line width = 2pt,
% color = redTelecom!50!white,
% ]
% table[x=d, y=PP5100, col sep= comma]
% {./Figures/PPE/PPE_17_5100_5spans.txt};}}
{\visible<2->{
\addplot [mark = pentagon*, mark size = 4pt, dashdotted, color = redTelecom] coordinates {
(7, 0.98964)
(107, 0.98972)
(207, 0.98972)
(308, 0.98980)
(407, 0.98976)
};}}
{\visible<2->{
\addplot [mark = pentagon*, mark size = 4pt, dashdotted, color = redTelecom] coordinates {
(67, 0.98858)
(167, 0.98865)
(267, 0.98868)
(368, 0.98865)
};}}
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
答案1
我建议使用tikz 库visible on=<...>
中的选项overlay-beamer-styles
:
\documentclass{beamer}
% packages
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
% customisations
\def \calR{\mathcal{R}}
\definecolor{grayTelecom}{RGB}{188,189,188}
\definecolor{redTelecom}{RGB}{191,18,56}
\mode<presentation>{}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\begin{frame}{Introduction: C-PPE and digital Dispersion Pre-Distortion (DPD)}
\begin{tikzpicture}[scale = 0.6]
\begin{axis}[
height = 10cm,
width = 10cm,
xlabel = {\Large $z$},
ylabel = {\Large Correlation profiles~(a.u.)},
xtick = {0,100,200,300,400,500},
ymin = 0.988,
ymax = 0.9942,
x tick label style = {font = \Large},
y tick label style = {font = \Large},
y tick label style={
/pgf/number format/precision=4
},
legend style = {draw=none, legend columns = 2, legend pos = north west, font = \Large},
]
\addplot [mark = none, color = gray,visible on=<2->] coordinates {
(0, 0.9901)
(100, 0.9882)
(100, 0.9901)
(200, 0.9882)
(200, 0.9901)
(300, 0.9882)
(300, 0.9901)
(400, 0.9882)
(400, 0.9901)
(500, 0.9882)
};
\addlegendentry[visible on=<2->]{$R$}
\addplot [mark = *, mark size = 4pt, dashdotted, color = black,visible on=<1->] coordinates {
(7, 0.99175)
(107, 0.99245)
(207, 0.99260)
(307, 0.99265)
(407, 0.99270)
};
\addlegendentry{$R^{(pd=5100)}$}
\addplot [mark = *, mark size = 4pt, dashdotted, color = black,visible on=<1->] coordinates {
(67, 0.99117)
(167, 0.99142)
(267, 0.99152)
(367, 0.99156)
};
\addlegendentry{$\calR$}
\addplot [mark = pentagon*, mark size = 4pt, dashdotted, color = redTelecom,visible on=<2->] coordinates {
(7, 0.98964)
(107, 0.98972)
(207, 0.98972)
(308, 0.98980)
(407, 0.98976)
};
\addplot [mark = pentagon*, mark size = 4pt, dashdotted, color = redTelecom,visible on=<2->] coordinates {
(67, 0.98858)
(167, 0.98865)
(267, 0.98868)
(368, 0.98865)
};
\addlegendentry[visible on=<2->]{$\calR^{(pd=5100)}$}
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}