I'd like to use the, imho, most common value alignment of x- and y-values in an external file and then produce an xbar with it. It shall look like the examples here (the better example because there are two values for each ytick) or here. Is that possible?
I'd rather not enter the data for the coordinates myself.
The MWE is based upon this post and does not work.
MWE
\documentclass[
a4paper
]{scrartcl}
\usepackage{
lmodern,
amsmath
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{
tikz,
pgfplots
}
\begin{filecontents}{data.csv}
Subjects;Min;Max
Test01;0.5;7
Test02;-2;4
Test03;-1;6
Test04;0;3
Test05;2;4
Test06;1;7
\end{filecontents}
\listfiles
\begin{document}
Test.
\begin{center}
\centering
\begin{tikzpicture}
\begin{axis}[
%
xbar,
xlabel={aaaa values},
ylabel={Subjects},
ytick=data,
nodes near coords, nodes near coords align={horizontal},
%yticklabels from table={data.csv}{Subjects},
%symbolic y coords={Test01,Test02,Test03,Test04,Test05,Test06}
]
\addplot table [x index=1, y index=0, col sep=semicolon] {data.csv};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
MWE 2 for aligning bars & labels
This MWE is there to show that the alignment of the x-labels and bars is off.
\documentclass[
a4paper
]{scrartcl}
\usepackage{
lmodern,
amsmath
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{
tikz,
pgfplots
}
\begin{filecontents}{data.csv}
Subjects;Min;Max
Test01;0.5;7
Test02;-2;4
Test03;-1;6
Test04;0;3
Test05;2;4
Test06;1;7
\end{filecontents}
\pgfplotstableread[col sep=semicolon]{
Subjects;Min;Max
Test01;0.5;7
Test02;-2;4
Test03;-1;6
Test04;0;3
Test05;2;4
Test06;1;7
}\tableabcdef
\begin{document}
Test.
\begin{center}
\centering
\begin{tikzpicture}
\begin{axis}[
xbar,
xlabel={aaaa values},
xmin=0,
%ytick=data,
nodes near coords, nodes near coords align={horizontal},
yticklabels from table={\tableabcdef}{Subjects},
]
%\addplot table [meta=Subjects, x=Min] {\tableabcdef};
\addplot table [meta=Subjects, x=Max] {\tableabcdef};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
Picture for MWE 2



y expr=\coordindexto the\addplot table [...]options (and load thepgfplotstablepackage) – Jake May 17 '14 at 09:53ytick=dataagain. – henry May 17 '14 at 09:56