如何正确对齐多行和多列的图?

如何正确对齐多行和多列的图?

由于 y 轴上的负值,我的图表行与行之间对齐不准确。它们也太靠右了。有什么办法可以解决这个问题吗?

它是什么样子的:

在此处输入图片描述

我的代码:

\begin{figure}[H]
\centering
\subfloat{%}
\begin{tikzpicture}
\begin{axis}[%
xlabel = {x},
ylabel = {y},
title = {0\degree}]%
\addplot[%
each nth point=100, 
filter discard warning=false, 
unbounded coords=discard,
color = blue,
only marks,
mark size = 0.8]
table[x index= 0,y index = 1,col sep=tab] {fi1.txt};
\end{axis}
\end{tikzpicture}
}%
\subfloat{%}
\begin{tikzpicture}
\begin{axis}[%
xlabel = {x},
ylabel = {y},
title = {72\degree}]%
\addplot[%
each nth point=100, 
filter discard warning=false, 
unbounded coords=discard,
color = blue,
only marks,
mark size = 0.8]
table[x index= 0,y index = 1,col sep=tab] {fi2.txt};
\end{axis}
\end{tikzpicture}
}%
\qquad
\subfloat{%}
\begin{tikzpicture}
\begin{axis}[%
xlabel = {x},
ylabel = {y},
title = {144\degree}]%
\addplot[%
each nth point=100, 
filter discard warning=false, 
 unbounded coords=discard,
 color = blue,
 only marks,
 mark size = 0.8]
 table[x index= 0,y index = 1,col sep=tab] {fi3.txt};
 \end{axis}
 \end{tikzpicture}
 }%
 \subfloat{%}
 \begin{tikzpicture}
 \begin{axis}[%
 xlabel = {x},
 ylabel = {y},
 title = {216\degree}]%
 \addplot[%
 each nth point=100, 
 filter discard warning=false, 
 unbounded coords=discard,
 color = blue,
 only marks,
 mark size = 0.8]
 table[x index= 0,y index = 1,col sep=tab] {fi4.txt};
 \end{axis}
 \end{tikzpicture}
 }%
 \qquad
 \subfloat{%}
 \begin{tikzpicture}
 \begin{axis}[%
 xlabel = {x},
 ylabel = {y},
 title = {288\degree}]%
 \addplot[%
 each nth point=100, 
 filter discard warning=false, 
 unbounded coords=discard,
 color = blue,
 only marks,
 mark size = 0.8]
 table[x index= 0,y index = 1,col sep=tab] {fi5.txt};
\end{axis}
\end{tikzpicture}
}%
\end{figure}

答案1

如果您不需要每个轴的标题,我建议将 s\subfloat全部删除。它们不是必需的。我还建议将前四个轴放在环境中groupplot,然后对齐是默认的。通过仅在外边缘上放置轴标签,您还可以节省一些空间。

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepackage{showframe} % for example, shows boundaries of text area
\newcommand{\degree}{$^\circ$} 
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{groupplot}[%
xlabel = {x},
ylabel = {y},
width=0.5\linewidth,
group style={
  group size={2 by 2},
  vertical sep=1.5cm,
  ylabels at=edge left,
  xlabels at=edge bottom},
every axis plot/.style={
  %each nth point=100, 
  filter discard warning=false, 
  unbounded coords=discard,
  color = blue,
  only marks,
  mark size = 0.8}
]%
\nextgroupplot[title = {0\degree}]
\addplot coordinates{(-5,-20)(12,0)};

\nextgroupplot[title = {72\degree}]%
\addplot coordinates{(0,0)(19,10)};

\nextgroupplot[title = {144\degree}]%
\addplot coordinates{(-5,-20)(12,0)};

\nextgroupplot[title = {216\degree}]%
 \addplot coordinates{(-5,-20)(12,0)};
\end{groupplot}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[%
  width=0.5\linewidth,
  xlabel = {x},
  ylabel = {y},
  title = {288\degree}]%
\addplot[%
% each nth point=100, 
 filter discard warning=false, 
 unbounded coords=discard,
 color = blue,
 only marks,
 mark size = 0.8]
coordinates{(-5,-20)(12,0)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

在此处输入图片描述

相关内容