# Pgfplots: vertical bar char prints only labels at one bar

I want to create a vertical bar charts with two bars in it. At the x-axis the bars shall be labeled with A and B. The label A is printed although it is not exactly properly positioned, but the label B seems to be swallowed entirely by something. See my attachment. Can someone tell me what I am missing?

Here is a MWE of my plot

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
enlargelimits=0.4,
symbolic x coords={A,B},
xtick=data,
nodes near coords,
]
\end{axis}
\end{tikzpicture}
\end{document}

• I think you need \addplot coordinates {(A,7)(B,4)}; – percusse Nov 9 '15 at 11:06
• I want the two bars to have different colours. – toobee Nov 9 '15 at 12:16

You can use [bar shift=0pt] to overwrite the original bar with one of a different color.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
enlargelimits=0.4,
symbolic x coords={A,B},
xtick=data,
nodes near coords,
bar shift=0pt
]