# When using pgfmathparse to offset plots, how can I remove the extra tick?

I plot a few data sets into the same chart using pgfplot and I therefore use \pgfmathparse to offset every plot a bit to the left or the right.

I found out that the first plot will always be the center of the tick thus I created a invisible center around which the others can be placed.

However this causes an extra tick to appear for the most left plot. The image below shows that the first a,b,c,d should not appear and the second tick is the correct one just right in the middle.

How could I remove this tick? I can remove the letter by using explicit xticklabels but the tick line still remains.

Below is a minimal example:

\documentclass{article}

\usepackage{pgfplots}
\usepackage{filecontents}
\begin{filecontents*}{testdata.csv}
var range1 range2
a 1 2
b 1 1
c 3 4
d 1 2
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xtick=data,
symbolic x coords={a,b,c,d}
]
\addplot +[only marks, forget plot, no markers]
table[x=var, y=range1]{testdata.csv};% the first plot is the center
table[x=var, y=range1]{testdata.csv};
table[x=var, y=range2]{testdata.csv};
\end{axis}
\end{tikzpicture}
\end{document}

-

xtick=data will set an xlabel for every data point, which you do not want in this example. In this particular case, you can just remove xtick=data and the correct labels will be set. In your real case, however, you might want to explicitly set the labels using something like xtick={a,b,c,d}. You might also want to set the text height of the x tick label style explicitly to something like 2ex to get the vertical placement of the letters right:

 \documentclass{article}

\usepackage{pgfplots}
\usepackage{filecontents}
\begin{filecontents*}{testdata.csv}
var range1 range2
a 1 2
b 1 1
d 1 2
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
symbolic x coords={a,b,c,d},
xtick={a,b,c,d},
x tick label style={text height=2ex}
]
table[x=var, y=range1]{testdata.csv};
table[x=var, y=range2]{testdata.csv};
\end{axis}
\end{tikzpicture}
\end{document}

-