[Tex/LaTex] Adding error bars to pgfplot with coordinate o

pgfplots

I'm just starting out with pgfplots, and am not overly steeped in Latex in general. I have the following, which isn't all the way there (I need to expand the width the accommodate the legend for example) but is getting there.

What I'd like to know is how to add error bars to one of the data sets when it's plotted via direct coordinate pairs like this? Or do I need to create a table?

\documentclass{article}

\usepackage{caption}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\centering
\label{ScoreVersusSize}
    \begin{tikzpicture}
        \begin{axis}[
                xlabel=Model Size,
                ylabel=Avg Project Score]
                \addplot coordinates {
                    (3, 0.608)
                    (4, 0.621)
                    (5, 0.589)
                    (6, 0.569)
                    (7, 0.549)
                    (8, 0.542)
                    (9, 0.558)
                    };
                \addlegendentry{Model Specific Score}
                \addplot coordinates {
                    (3, 0.577)
                    (4, 0.577)
                    (5, 0.577)
                    (6, 0.577)
                    (7, 0.577)
                    (8, 0.577)
                    (9, 0.577)
                    };
                    \addlegendentry{Aggregate Average Score}
        \end{axis}
    \end{tikzpicture}
    \caption{Average Score versus Model Size}
\end{figure}

\end{document}

Best Answer

Step 1 -- read the manual!

\documentclass{article}

\usepackage{caption}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\centering
\label{ScoreVersusSize}
    \begin{tikzpicture}
        \begin{axis}[
                xlabel=Model Size,
                ylabel=Avg Project Score]
            \addplot+[error bars/.cd,
                       y dir=both, y explicit]
                    coordinates {
                    (3, 0.608)  +- (0.0495, 0.0495)
                    (4, 0.621)  +- (0.0406, 0.0406)
                    (5, 0.589)  +- (0.0410, 0.0410)
                    (6, 0.569)  +- (0.0381, 0.0381)
                    (7, 0.549)  +- (0.0354, 0.0354)
                    (8, 0.542)  +- (0.0341, 0.0341)
                    (9, 0.558)  +- (0.0331, 0.0331)
                    };
                \addlegendentry{Model Specific Score}
                \addplot[mark = none, red] coordinates {
                    (3, 0.577)
                    (4, 0.577)
                    (5, 0.577)
                    (6, 0.577)
                    (7, 0.577)
                    (8, 0.577)
                    (9, 0.577)
                    };
                    \addlegendentry{Aggregate Average Score}
        \end{axis}
    \end{tikzpicture}
    \caption{Average Score versus Model Size}
\end{figure}