I want to show a plot in a beamer frame. I tried to do it like this
\documentclass[]{beamer}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{frame}{Comparison to template fitting}
\begin{tikzpicture}
\begin{axis}[]
\addplot table [] {
0.22 0.56
0.43 0.54
0.65 0.53
0.86 0.55
1.08 0.48
1.3 0.34
1.52 0.17
1.73 0.23
1.95 0.16
2.17 0.17
2.38 0.23
2.6 0.26
};
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
But this raises the error
! Package pgfplots Error: Could not read table file '" 0.22 0.56 0.43 0.54 0.65
If I change the document class to article and remove the frame, I don't have any problem
\documentclass[]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
%\begin{frame}{Comparison to template fitting}
\begin{tikzpicture}
\begin{axis}[]
\addplot table [] {
0.22 0.56
0.43 0.54
0.65 0.53
0.86 0.55
1.08 0.48
1.3 0.34
1.52 0.17
1.73 0.23
1.95 0.16
2.17 0.17
2.38 0.23
2.6 0.26
};
\end{axis}
\end{tikzpicture}
%\end{frame}
\end{document}
So the plot itself is fine.
How can I use my pgfplot in a beamer frame?

