I am trying to draw a horizontal bar plot using Tikz and I would like to use non-numerical tags for the x axis.
More precisely, I have the following diagram:
and I would like to change the numeral tags 1, 2, 3, 4, 5 and 6, by the usual language levels A1, A2, B1, B2, C1, and C2.
The code is
\documentclass{article}
\usepackage{pgfplots, pgfplotstable}
\usepackage{tikz}
\usetikzlibrary{shapes, backgrounds,mindmap, trees}
\begin{document}
\section{Spanish Level (CEFR)}
\begin{center}
\begin{tikzpicture}
\pgfplotstableread{ % Table macro
Label First Second
Speaking 5 1
Listening 3 1
Reading 2 2
Writing 3 1
}\datatable
\begin{axis}[
axis line style={draw=none},
enlargelimits=.1,
xlabel={CEFR level},
xbar stacked, % Stacked horizontal bars
xmin=0.5,
tick style={draw=none},
y=-0.5cm,
bar width=0.4cm,
enlarge y limits={abs=0.45cm},
ytick=data,
yticklabels from table={\datatable}{Label}, % Get the labels from the Label column of the \datatable
legend style={at={(.5,-.5)}, anchor=north}
]
% Plot the "First" column against the data index
\addplot [fill=red] table [x=First, y expr=\coordindex] {\datatable};
\addplot [fill=red!20!blue] table [x=Second, y expr=\coordindex] {\datatable};
%\addplot [fill=red!80!yellow] table [x=Third, y expr=\coordindex] {\datatable};
\legend{certified, de facto}
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

xticklabels={A1, A2, <etc>}– Torbjørn T. Jul 31 '19 at 15:48