# marking statistically significant results in bar graph using pgfplots

I'm making a bar chart with pgfplots and would like to put an asterisk above some bars to show statistical significance (p < 0.05). Any ideas?

Here's an example graph:

\begin{tikzpicture}
\begin{axis}[
symbolic x coords={(a),(b),(c),(d),(e)},
xtick=data]
((a),51365) % I'd like to put an asterisk above some of these
((b),74531)
((c),52862)
((d),78999)
((e),71825)
};
\end{axis}
\end{tikzpicture}

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. You can include a small data file or a table to demonstrate the plot you are working with. Use the search string [pgfplots] filecontents on this site for many examples. – percusse Sep 30 '12 at 17:31
Thanks! Please see edit for a sample graph. – stewartml Sep 30 '12 at 18:55

I would use the nodes near coords functionality together with point meta=explicit symbolic for this:

\documentclass[border=5mm]{standalone}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
symbolic x coords={(a),(b),(c),(d),(e)},
xtick=data,
ymin=0,
point meta=explicit symbolic,
nodes near coords
]
(a) 51365 *
(b) 74531 \\
(c) 52862 *
(d) 78999 \\
(e) 71825 \\
};
\end{axis}
\end{tikzpicture}

\end{document}

-
This method is slightly nicer than Peter's, so I'm marking it as the answer, thanks. Why is there a comma between Y and Sig on the first line of the table? – stewartml Oct 3 '12 at 13:54
@stewartml: Sorry, that comma wasn't supposed to be there. I've edited the answer slightly to do away with the column names. It sounds like you're not entirely happy with the answer, though? Could you elaborate on how you'd rather specify which results to highlight (or if there's anything else that's you're not happy with)? – Jake Oct 3 '12 at 14:03
No, I think the answer is great thanks! Although Peter's works, I prefer yours, is all I meant. Nice and straightforward. – stewartml Oct 3 '12 at 23:32

Not sure that this is a satisfactory answer but you could specify the xticklabels={(a),(b),(c),(d),(e)}, use numerical values for the x-values, and then place a node above the ones you want to highlight:

## Code:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xticklabels={(a),(b),(c),(d),(e)},
xtick=data,
]
\node [above, red, font=\Large] at (axis cs: 1,51365) {$\ast$};