[Tex/LaTex] pgfplots bar graph: Bars are floating above the x-axis

bar chartpgfplotsspacing

I'm trying to visualize some data with bar graphs. Some of those bar graphs work fine and some (with the same code, just different data points) have the bars "floating above the x-axis". This bar graph works fine:

\begin{tikzpicture}
        \begin{axis}[
            ybar,
            bar width=40,
            enlarge x limits=0.3,
            legend style={at={(0.5,-0.2)},
            anchor=north,legend columns=-1},
            ylabel={\# Participants},
            symbolic x coords={no limit,unclear},
            xtick=data,
            nodes near coords,
            ]
            \addplot coordinates {(no limit,17) (unclear,5)};
        \end{axis}
    \end{tikzpicture}

And this one has a distance between the onset of the bars and the x-axis that I would like to eliminate:

\begin{tikzpicture}
        \begin{axis}[
            ybar,
            bar width=40,
            enlarge x limits=0.3,
            legend style={at={(0.5,-0.2)},
            anchor=north,legend columns=-1},
            ylabel={\# Participants},
            symbolic x coords={x-10,other},
            xtick=data,
            nodes near coords,
            ]
            \addplot coordinates {(x-10,22) (other,0)};
        \end{axis}
    \end{tikzpicture}

I found different similar questions on tex-exchange, but the solutions don't seem to apply: I don't have an "enlarge y limits"-factor, and one solution mentioned setting ymin=0 as an argument in axis, which didn't change anything.

Best Answer

While @percusse has given you a working solution for graph 2, ymin=0 also works, but I note you said it didn't work for you. There must be a difference between what I have posted below and what you tested. You can also use ymin=0 in the second graph, if I have interpreted the problem correctly.

enter image description here

This is the code, only very slightly modified from your version by adding ymin=0,. By the way, it is always best to post full, compilable minimum working examples, inclusive of document class, the minimum packages and libraries that you are using.

\documentclass[border=10pt,crop=true]{standalone}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[
    ybar,
    bar width=40,
    ymin=0, %<--- Set the y-axis minimum value
    enlarge x limits=0.3,
    legend style={at={(0.5,-0.2)},
        anchor=north,legend columns=-1},
    ylabel={\# Participants},
    symbolic x coords={x-10,other},
%    enlarge y limits={upper=0}, % another option to reset the x-axis intersection with the y-axis for this graph
    xtick=data,
    nodes near coords,
    ]
    \addplot coordinates {(x-10,22) (other,0)};
    \end{axis}
    \end{tikzpicture}%
    \qquad
    \begin{tikzpicture}
    \begin{axis}[
    ybar,
    bar width=40,
    ymin=0, %<--- Set the y-axis minimum value
    enlarge x limits=0.3,
    legend style={at={(0.5,-0.2)},
        anchor=north,legend columns=-1},
    ylabel={\# Participants},
    symbolic x coords={x-10,other},
    xtick=data,
    nodes near coords,
    ]
    \addplot coordinates {(x-10,22) (other,1)};
    \end{axis}
    \end{tikzpicture}
\end{document}