我正在使用 beamer 准备演示文稿,我想知道是否有可能有两个单独的框架显示相同 colorbrewer 主题的曲线(就好像它们是在单个 tikz 图形上制作的一样)。这是 MWE:
\documentclass[xcolor={dvipsnames,table}, fleqn]{beamer}
\usefonttheme{professionalfonts}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{
% initialize Dark2
cycle list/Set2,
% combine it with 'mark list*':
cycle multiindex* list={
mark list*\nextlist
Set2\nextlist
},
}
\begin{document}
\begin{frame}[fragile]
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot + table[row sep=crcr]{%
60 0.8209744486252566 \\
405 0.5465621514772466\\
};
\addplot + table[row sep=crcr]{%
51 1.0295914003166593\\
339 0.6542156171940078 \\
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{frame}
\begin{frame}[fragile]
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot table[row sep=crcr]{%
60 0.7412105340227999 \\
405 0.5183949403933881\\
};
\addplot table[row sep=crcr]{%
51 0.7179052621980517 \\
339 0.4911184551364445 \\
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
您会看到第二帧中的颜色与第一帧中的颜色相同,但我希望第二个 tikz 图形继续从前一帧开始循环。这可能吗?
答案1
您可以使用\pgfplotsset{cycle list shift=2}
将第二个图的起始颜色移动 2:
\documentclass[xcolor={dvipsnames,table}, fleqn]{beamer}
\usefonttheme{professionalfonts}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{
% initialize Dark2
cycle list/Set2,
% combine it with 'mark list*':
cycle multiindex* list={
mark list*\nextlist
Set2\nextlist
},
}
\begin{document}
\begin{frame}[fragile]
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot + table[row sep=crcr]{%
60 0.8209744486252566 \\
405 0.5465621514772466\\
};
\addplot + table[row sep=crcr]{%
51 1.0295914003166593\\
339 0.6542156171940078 \\
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{frame}
\pgfplotsset{cycle list shift=2}
\begin{frame}[fragile]
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot table[row sep=crcr]{%
60 0.7412105340227999 \\
405 0.5183949403933881\\
};
\addplot table[row sep=crcr]{%
51 0.7179052621980517 \\
339 0.4911184551364445 \\
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}