PGFplots:在多页上打印组图

PGFplots:在多页上打印组图

对于这个 MWE,我有 8 个图,但只打印了 6 个,最后两个被忽略了。那么,有没有办法让 PGFplots 根据图/页面的大小将组图分成多页?

\documentclass[a4paper,twocolumn]{article}
\usepackage{pgfplots,mathtools}
\usepackage[showframe]{geometry}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{groupplot}[
group style={
    group name=G,
    group size=2 by 3,
}, xtick=\empty, ytick=\empty, ztick=\empty
]
\nextgroupplot[title=1]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=2]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=3]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=4]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=5]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=6]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=7,colorbar horizontal,]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
%
\nextgroupplot[title=8]
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{groupplot}
\end{tikzpicture}
\caption{some caption}
\end{figure}
\end{document}

在此处输入图片描述


编辑

对于这个 MWE,如何保护长表并防止它被另一个内容(例如此处的另一个示例图)中断?

此外,如何使长表的标题被视为图形的标题,以避免出现具有相同数字的图形冲突?

\documentclass[a4paper]{article}
\usepackage{pgfplots,mathtools}
\usepackage[showframe]{geometry}
\usepackage{longtable,lipsum}
\usepackage{caption}
\pgfplotsset{compat=1.16}
\pgfplotsset{my group style/.style={title style = {at={(0.5,1)}, above}
, xtick=\empty, ytick=\empty, ztick=\empty}}
\begin{document}

%\lipsum[1] 
\captionsetup[longtable]{name=Figure}
\begin{longtable}{cc}
\endfoot
\caption{A table that pretends to be a figure.}\label{fig:ManyPlots}
\endlastfoot
\begin{tikzpicture}
\begin{axis}[my group style,title=1] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=2] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=3] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=4] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=5] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=6] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=7] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=8] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}
\end{longtable}
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image}
    \caption{caption}
\end{figure}

\end{document}

在此处输入图片描述

答案1

这充其量只是一项紧急建议。但是,我认为将 拆分为tikzpicture多个页面并不简单,而当前版本的组图位于 内tikzpicture。但是,人们可以求助于上个千年的包:longtable。(请注意,我无法\captionof{figure}{...}在 的标题中使用longtable,猜想这将是一个单独的问题。解决了,非常感谢 Alan Munn!)这将处理分页符,如果您为通用事物定义样式,那么打字方面的额外努力就不算太糟糕了。编辑:希望更新版本后能解决提问者提到的反击问题。

\documentclass[a4paper]{article}
\usepackage{pgfplots,mathtools}
\usepackage[showframe]{geometry}
\usepackage{longtable,lipsum}
\usepackage{caption}
\pgfplotsset{compat=1.16}
\pgfplotsset{my group style/.style={title style = {at={(0.5,1)}, above}
, xtick=\empty, ytick=\empty, ztick=\empty}}
\begin{document}

%\lipsum[1] 
\captionsetup[longtable]{name=Figure}
\captionlistentry[figure]{longtable}
\begin{longtable}{cc}
\endfoot
%\captionsetup{type=figure}
\caption[figure]{A table that pretends to be a figure.}\label{fig:ManyPlots}
\endlastfoot
\begin{tikzpicture}
\begin{axis}[my group style,title=1] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=2] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=3] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=4] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=5] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=6] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}\\
\begin{tikzpicture}
\begin{axis}[my group style,title=7] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}& 
\begin{tikzpicture}
\begin{axis}[my group style,title=8] 
\addplot3 [
surf,
domain=-2:2,
domain y=-1.3:1.3,
] {exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}
\end{longtable}
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image}
    \caption{caption}
\end{figure}

\end{document}

在此处输入图片描述

相关内容