# X-Bar plot with intervall (a,b) rather than (0,a)

When one makes a xbar plot using pgfplots, the bar always goes from 0 to the requested coordinate. For example (p. 78 in pgfplots manual):

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar, xmin=0,
width=12cm, height=3.5cm, enlarge y limits=0.5,
symbolic y coords={no,yes},
ytick=data,
nodes near coords, nodes near coords align={horizontal},
]
\end{axis}
\end{tikzpicture}
\end{document}


However, I'd like the bars to be at different intervals, say no: 1 to 3, yes: 2 to 7. I didn't find anything in the manual that I could immediately apply to my problem.

You can use stacked plots for this, with the first series made invisible using draw=none, forget plot:

\documentclass{article}
\usepackage{pgfplots, pgfplotstable}
\begin{document}

Lower Upper Name
1 3 no
2 7 yes

\begin{tikzpicture}
\begin{axis}[
xbar, xmin=0,
width=12cm, height=3.5cm, enlarge y limits=0.5,
symbolic y coords={no,yes},
ytick=data,xbar stacked,
bar shift=0pt
]