# xticks steps using Pgfplots / dateplot

I am using pgfplots to plot the following diagram with monthtly data over 20 years. However, I am not quite satisfied with the labels on the x axis. I'd like to have steps of say 3 years (e.g. 1994, 1997, 2000, 2003, 2006, 2009, 2012). Right now there are steps of 2 years and 3 years. Can anyone help?

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\begin{document}

\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=13cm, height=9cm,
date coordinates in=x,
xticklabel style={/pgf/number format/1000 sep=},
date ZERO=1993-01-01,
xticklabel={\year},
xmin={1993-01-01},
xmax={2013-11-01},
ymin=0.01,
ymax=30,
tick pos=left,
legend pos=outer north east,
legend cell align=left,
]

\end{axis}
\end{tikzpicture}
\end{center}
\end{figure}

\end{document}


You can use dates in xtick to specify where you want xticks, e.g.

xtick = {
{1994-01-01},
{1997-01-01},
{2000-01-01},
{2003-01-01},
{2006-01-01},
{2000-01-01},
{2012-01-01}
}


Add this to the axis options.

• That's exactly what I was looking for. Thank you so much! I was trying xtick before but obviously in the wrong format. – pukas Jan 4 '14 at 20:27
• @pukas Glad I could help. Perhaps you would consider accepting my answer by clicking the checkmark on the left, that marks the question as resolved, and awards some points to both yourself and me. – Torbjørn T. Jan 5 '14 at 9:05