[Tex/LaTex] Not all tick labels are shown when using xtick=data


I'm trying to draw the following plot:


            ymin=0, ymax=90,
            symbolic x coords={A,B},
            bar width=15pt,
            axis lines*=left,
            nodes near coords,
            xticklabel style={text height=1.5ex},
            enlarge x limits=.3,
            \addplot[fill=red] coordinates {
            \addplot[fill=green] coordinates {

However it does not seem to work out: the second xtick coordinate (B) doesn't show up.

What I want is to have a simple plot with two or more bars each with a different color.

thanks for your help

Best Answer

When you use xtick=data, only the first \addplot command is used to determine the tick positions. To get both tick labels, use xtick={A,B}.

By default, PGFPlots assumes that each \addplot series will have values at the same coordinates, which is why the bars for each series are offset to prevent overlap. In your special case of all \addplot commands using different coordinates, that's not desired. To switch off this shift, set set bar shift=0pt.