# Shift every second ticklabel

I have a chart with long xaxis tick labels (text). There a way to shift every second tiklabel as it is done in Axis tick numbers overlap in TikZ for all tick labels?

-
I don't know of an algorithmic way (of course this is TeX, so there must be a way), but could help you if you showed a specific case by composing a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem, and this would actually ensure that the proposed solution works for your specific case. –  Peter Grill Oct 25 '12 at 19:06

I don't know how to do it for the ticks themselves as they follow, say the data etc. but for the labels you can make a quick hack. I've taken the code from the linked question since you did not provide a MWE.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[%
xmin=0, xmax=4,
ymin=-2, ymax=2,
xticklabel={
\ifodd\ticknum$\pgfmathprintnumber\tick$
\else
\hspace{1.5cm}$\pgfmathprintnumber\tick$
\fi}
]
\end{axis}
\end{tikzpicture}
\end{document}


-
+1, but I think the OP wants to shift every second label away from the axis (instead of along it) to avoid labels overlapping. So you could use \raisebox{-4ex}{$\pgfmathprintnumber\tick$} instead of the \hspace. –  Jake Oct 26 '12 at 9:34
@Jake Now that you say it, I also think you are right. Sometimes I'm even surprised by my misunderstanding abilities :) –  percusse Oct 26 '12 at 9:41
That was exactly what I was looking for,:) Thanks –  Moe Oct 26 '12 at 11:53