
groupplots
ライブラリを使用してpgfplots
プロットのグループ化を作成しています。2x2のサイズを使用していますが、プロットは3つしかありません。一番右のプロットを垂直に中央に配置して、逆さまではなく三角形にするにはどうすればよいでしょうか。ら? 別のケースでは、下のプロットを水平方向に中央揃えにしたいのですが、同じ手順を使用しますか? より優れたツールはありますかgroupplots
?
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={group size=2 by 2},
width=4cm, height=4cm,
]
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\end{groupplot}
\end{tikzpicture}
\end{document}
答え1
Jake の提案のおかげで、私の元のソリューションを大幅に圧縮することが可能になりました (私は tikz について何も知りません)。また、 の新しいバージョンがstackengine
今週末にリリースされる予定です。ここで使用した構文は、古いバージョンと新しいバージョンの両方で機能します。必要に応じて、プロット間の間隔を制御できます (つまり、通常の hspacing は上部の 2 つのプロット間で機能し、 のオプションの長さ引数は\stackunder
垂直方向のギャップを定義します)。
\documentclass{standalone}
\usepackage{stackengine}
\usepackage{tikz,pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
\stackunder{%
\begin{tikzpicture}
\begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
(0,0) (1,2) (2,1)}; \end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
(0,0) (1,2) (2,1)}; \end{axis}
\end{tikzpicture}
}{%
\begin{tikzpicture}
\begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
(0,0) (1,2) (2,1)}; \end{axis}
\end{tikzpicture}
}
\end{document}