# How to create symbolic x coords without losing last bar

I've created a bar chart with labels for the x coordinates. But if I don't put a xmin/xmax in, only half of the first and last bar appear. If I add a xmax it shows up on the axis.

\begin{figure}[h!]
\small
\begin{tikzpicture}
\begin{axis}[%
width=3.5in,
height=1.5in,
axis x line=center,
axis y line=left,
symbolic x  coords={0,Choice1,Choice2 Here,Choice3 Here,Choice4 Goes Here,Last Choice, 1},
ymin=0, ymax=2,
xmin=0, xmax=1,
nodes near coords,
ylabel style={align=center},
ylabel={Mean days\\per month},
x tick label style={font=\small,text width=1cm,align=center},
ybar]

\addplot[color=blue,fill] coordinates {(Choice1,0.6)(Choice2 Here,0.1) (Choice3 Here,1.6)};

\end{axis}
\end{tikzpicture}
\end{figure}


-

Instead of setting all values for xmin, ymin, xmax, ymax, use enlargelimits=true:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\small
\begin{tikzpicture}
\begin{axis}[%
width=3.5in,
height=1.5in,
axis x line=center,
axis y line=left,
symbolic x  coords={Choice1,Choice2 Here,Choice3 Here,Choice4 Goes Here,Last Choice},
enlargelimits=true,
ymin=0,
nodes near coords,
ylabel style={align=center},
ylabel={Mean days\\per month},
x tick label style={font=\small,text width=1cm,align=center},
ybar]

\addplot[color=blue,fill] coordinates {(Choice1,0.6) (Choice2 Here,0.1) (Choice3 Here,1.6)};

\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}


As Jake has suggested in a comment, with bar charts it is advisable to include the origin in the axis range explicitly (in this case by using ymin=0 in addition to enlargelimits).

As a side note, I'd suggest you not to use the too restrictive [!h] option for float placement; use a less restrictive one or don't use any at all.

-
The enlargelimits=true fixed the problem. I will also take your recommendations to further improve the image. –  user2433701 Sep 17 '13 at 13:15
@Jake I've incorporated your suggestion to my answer. Thanks! –  Gonzalo Medina Sep 17 '13 at 13:16