[Tex/LaTex] How to put multiple figures in beamer

beamerminipagetikz-pgf

enter image description hereI'm trying to insert multiple tikzpictures (scatter plots) in beamer. I've tried follwing the tips given for similar issues, but stil it doesn't even compile.
Here is the original code I used in my article format:

\documentclass[mathserif,10pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{adjustbox}
\usepackage[beamer,customcolors]{hf-tikz}
\usepackage{pgfplots}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shadows,arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.text}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.7}
\usetheme{Warsaw}
\usecolortheme{default}
\begin{document}
\begin{frame}{Correlations of parents and preschoolers scores}
\begin{figure}[!htbp]
\begin{center}
\begin{minipage}[b]{0.45\textwidth}
\centering
\begin{tikzpicture}[scale=0.6]
\begin{axis}[%
 legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
 xlabel=Parents awareness score; pre-assessment,
 ylabel=Child's behavior score; pre-assessment,
 xshift=0.1cm,
 yshift=0.1cm]%
 \addplot [scatter,mark=+,only marks]
    table []{values.data};
 \addplot[draw=none]
    table[
      header=false,
      y={create col/linear regression},
    ] {values.data};
 \addplot[domain=5:30,black]
    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
 \end{axis}
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}[b]{0.45\textwidth}
\centering
\begin{tikzpicture}[scale=0.6]
\begin{axis}[%
 legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
 xlabel=Parents awareness score; post-assessment,
 ylabel=Child's behavior score; post-assessment,
 xshift=0.1cm,
 yshift=0.1cm]%
 \addplot [scatter,mark=+,only marks]
    table []{values2.data};
 \addplot[draw=none]
    table[
      header=false,
      y={create col/linear regression},
    ] {values2.data};
  \addplot[domain=5:30,black]
    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
 \end{axis}
\end{tikzpicture}
\end{minipage}
\end{center}
\caption[Correlation between parents awareness score and child's behavior score amid the intervention sample]{Correlation between parents awareness score and child's behavior score amid the intervention sample.}
\end{figure}
\end{frame}
\end{document}

Best Answer

You have

\includegraphics[width=0.8\linewidth]{
\begin{tikzpicture}[scale=0.9]..}

that is never going to work, the argument to \includegraphics is a file name but here you have no images but a tikz picture which is tex code, just delete the \includegraphics commands.


\documentclass[mathserif,10pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{adjustbox}
\usepackage[beamer,customcolors]{hf-tikz}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shadows,arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.text}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.7}
\usetheme{Warsaw}
\usecolortheme{default}
\begin{document}
\begin{frame}{Correlations of parents and preschoolers scores}
\begin{columns}
\column{0.5\textwidth}
\begin{minipage}[c][0.4\textheight][c]{\linewidth}
\centering
\begin{tikzpicture}[scale=0.9]
\begin{axis}[%
 legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
 xlabel=Parents awareness score; pre-assessment,
 ylabel=Child's behavior score; pre-assessment,
 xshift=0.1cm,
 yshift=0.1cm]%
%\addplot [scatter,mark=+,only marks] table []{values.data};
%\addplot[draw=none]
%    table[
%      header=false,
%      y={create col/linear regression},
%    ] {values.data};
%\addplot[domain=5:30,black]
%    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
\end{axis}
\end{tikzpicture}
\end{minipage}
\begin{minipage}[c][0.4\textheight][c]{\linewidth}
\centering
\begin{tikzpicture}[scale=0.9]
\begin{axis}[%
legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
xlabel=Parents awareness score; post-assessment,
ylabel=Child's behavior score; post-assessment,
xshift=0.1cm,
yshift=0.1cm]%
%\addplot [scatter,mark=+,only marks]
%table []{values2.data};
%\addplot[draw=none]
%    table[
%      header=false,
%      y={create col/linear regression},
%    ] {values2.data};
%  \addplot[domain=5:30,black]
%    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
\end{axis}
\end{tikzpicture}
\end{minipage}
\column{0.5\textwidth}
\begin{minipage}[c][0.4\textheight][c]{\linewidth}
 \centering
\begin{tikzpicture}[scale=0.9]
 \begin{axis}[%
 legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
 xlabel=Parents awareness score; pre-assessment,
 ylabel=Child's behavior score; pre-assessment,
 xshift=0.1cm,
 yshift=0.1cm]%
% \addplot [scatter,mark=+,only marks]
%     table []{values3.data};
% \addplot[draw=none]
%    table[
%      header=false,
%      y={create col/linear regression},
%    ] {values3.data};
%  \addplot[domain=5:30,black]
%    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
\end{axis}
\end{tikzpicture}
\end{minipage}
\begin{minipage}[c][0.4\textheight][c]{\linewidth}
\centering

\begin{tikzpicture}[scale=0.9]
\begin{axis}[%
legend style={at={(0.7,0.5)},anchor=south west,font=\footnotesize},
xlabel=Parents awareness score; post-assessment,
ylabel=Child's behavior score; post-assessment,
xshift=0.1cm,
yshift=0.1cm]%
%\addplot [scatter,mark=+,only marks]
%table []{values4.data};
%\addplot[draw=none]
%    table[
%      header=false,
%      y={create col/linear regression},
%    ] {values4.data};
%  \addplot[domain=5:30,black]
%    {\pgfplotstableregressiona*x + \pgfplotstableregressionb};
\end{axis}
\end{tikzpicture}
\end{minipage} 
\end{columns} 
\end{frame}
\end{document}