I am trying to use Jake's excellent Tufte y bar chart style but I am getting an
! Undefined control sequence.
<argument> {rel axis cs:0,0}-|{axis cs:\pgfplots
@data@xmin,0}
l.54 \end{axis}
when trying to draw the x-axis. I've installed TexLive from the website on Ubuntu 12.04 and, according to tlmgr info <package>
am using pgf version 2.10 and pgfplots version 1.7. NB: My tufte ybar is slightly adjusted but not in the critical part of the code, and I get the same error when using the code provided by Jake in his original post.
MWE:
\documentclass{article}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}
%% Color definitions
\definecolor{tufte1}{rgb}{0.7,0.7,0.55}
%% Tufte-style Y bar chart
\pgfplotsset{
tufte ybar/.style={
ybar,
hide x axis,
axis line style={opacity=0},
major tick style={draw=none},
ymin=0,
bar width=0.7em,
ymajorgrids,
major grid style=white,
axis on top,
cycle list={
fill=tufte1, draw=none\\
},
after end axis/.code={
\draw [very thick, tufte1] ({rel axis cs:0,0}
-|{axis cs:\pgfplots@data@xmin,0})
++(-0.5*\pgfkeysvalueof{/pgf/bar width},0pt)
-- ({rel axis cs:0,0}-|{axis cs:\pgfplots@data@xmax,0})
-- ++(0.5*\pgfkeysvalueof{/pgf/bar width},0pt);
},
}
}
\begin{filecontents}{mwe.dat}
1,3
2,1
3,16
4,0
5,13
6,3
7,33
8,1
9,26
\end{filecontents}
\begin{document}
\pgfplotstableread [col sep=comma]{mwe.dat}\datatable
\begin{tikzpicture}
\begin{axis}[tufte ybar, width=\textwidth,
ytick={5,10,...,35}, yticklabel style={font=\tiny},
nodes near coords, every node near coord/.append style={font=\tiny}
]
\addplot table \datatable;
\end{axis}
\end{tikzpicture}
\end{document}
\makeatletter
before, and\makeatother
afterpgfplotsset
as per the link provided.\makeatletter
and\makeatother
do in principle, but didn't realise that's where the problem was ... If one of you wants to post it as an answer, I'll be glad to accept it.