我通过以下代码生成了上图。
\documentclass{article}
\usepackage{pgfplots}
\usepackage{subcaption}
\usepgfplotslibrary{groupplots}
\pgfplotsset{width=8cm,compat=1.5}
\begin{document}
\begin{figure}[!h]
\begin{subfigure}[t]{0.48\textwidth} \centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 1}, height=2in, width=2in]
\nextgroupplot
\addplot [color=blue]coordinates {(0,0) (1,1) (2,2)};
\nextgroupplot
\addplot [color=red]coordinates {(0,2) (1,1) (2,0)};
\end{groupplot}
\end{tikzpicture}
\end{subfigure}
\vskip 30pt
\begin{subfigure}[t]{0.48\textwidth} \centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 1}, height=2in, width=2in]
\nextgroupplot
\addplot coordinates {(0,0) (1,1) (2,2)};
\nextgroupplot
\addplot coordinates {(0,2) (1,1) (2,0)};
\end{groupplot}
\end{tikzpicture}
\end{subfigure}
\end{figure}
\end{document}
我应该如何修改我的代码才能获得如下两幅图?