I'm doing a graph with vertical bars (ybar) where each bar represents not a number (1) but a class ([-0.5,0.5]).
I would prefer that tick labels on the x axis appeared near the ticks marks, so marking the limits of each interval/class and not how they actually appear, at the center of the bar. How can I do this?
My code:
\documentclass{article}
% ---------------------------------- tikz
\usepackage{pgfplots} % to print charts
\pgfplotsset{compat=1.8}
%
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis} [
% general
ybar interval,
scale only axis,
height=0.5\textwidth,
width=\textwidth,
ylabel={Dots numbers},
xlabel={Variation},
xticklabel style={
rotate=90,
anchor=east,
},
minor xtick={-6,...,6},
enlargelimits=false,
]
\addplot table [
x=grade,
y=value,
] {
grade value
-7 0
-6 0
-5 3
-4 1
-3 2
-2 15
-1 11
0 179
1 8
2 1
3 0
4 1
5 2
6 0
7 0
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
And the graph: