
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은 상위 두 플롯 사이에서 작동하고 선택적 길이 인수는 \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}