How can I use the \input command in pgfplots?

I think the best way is to define a style with \pgfplotsset{SomeStyleName/.style={<options>}}. Note that using group style={...} directly in the definition of the new style doesn't work (see Group style key does not work in pgfplotsset), which is why I use the more verbose group/<key>=<value>.

\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.12,
    MyPlotStyle/.style={
       width=6.0cm,
       height=4.0cm,
       xmin=0.0,
       xmax=1.0,
       xlabel=$x$,
       group/group size=1 by 2
       }
}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
MyPlotStyle
  ]
  \nextgroupplot[ymin=0.0,ymax=1.0,ylabel={$y_2$}]
  \addplot table {
   0.1 0.9
   0.9 0.1
  }; 
  \nextgroupplot[ymin=0.0,ymax=1.0,ylabel={$y_1$}]
  \addplot table {
   0.1 0.2
   0.9 0.8
  }; 
\end{groupplot}
\end{tikzpicture}
\end{document} 

enter image description here


Try something as follows:

\documentclass[10pt]{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\pgfplotsset{compat=1.12}

    \begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
    \pgfplotsset{width=6.0cm,height=4.0cm,  %<-- group plot "style": common options
                 group style = {group size=1 by 2},
                 xmin = 0,  xmax = 1,   xlabel=$x$,
                 ymin = 0,  ymax = 1}
\begin{groupplot}
  \nextgroupplot[ylabel={$y_2$}]
  \addplot table {
   0.1 0.9
   0.9 0.1
  };
  \nextgroupplot[ylabel={$y_1$}]
  \addplot table {
   0.1 0.2
   0.9 0.8
  };
\end{groupplot}
\end{tikzpicture}
    \end{document}

In above code I use only necessary packages.

enter image description here