trazar datos estadísticos, poner años en Xticklabel PGFplot

trazar datos estadísticos, poner años en Xticklabel PGFplot

Quiero trazar estos datos y no sé cómo poner los años en el eje X. Quiero mostrar todos los años, no un paso de 5 años.

\begin{tikzpicture}
\begin{axis}[width=8cm,
x tick label style={
/pgf/number format/1000 sep=},
ylabel=Tonnes,
]
\addplot
coordinates {(1992,205.0)
(1993,297.0)
(1994,395.0)
(1995,1601.0)
(1996,213.0)
(1997,241.0)
(1998,203.0)
(1999,372.0)
(2004,300.26)
(2005,446.17)
(2006,530.4)
(2007,591.38)
(2008,948.04)
(2009,596.01)
(2010,768.448)
(2011,978.0)
(2012,1050.0)};
\end{axis}
\end{tikzpicture}

Leí en el manual sobre una función { \year.} y lo intenté pero no funcionó. gracias

Respuesta1

No necesitas dateplotpara esto. Solo úsalo xtck=datajunto con

xticklabel style=
{/pgf/number format/1000 sep=,rotate=60,anchor=east,font=\scriptsize},

Aquí está el código completo:

\documentclass{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
  \begin{tikzpicture}
\begin{axis}[width=8cm,
xtick=data,
xticklabel style=
{/pgf/number format/1000 sep=,rotate=60,anchor=east,font=\scriptsize},
ylabel=Tonnes,
]
\addplot
coordinates {(1992,205.0)
(1993,297.0)
(1994,395.0)
(1995,1601.0)
(1996,213.0)
(1997,241.0)
(1998,203.0)
(1999,372.0)
(2004,300.26)
(2005,446.17)
(2006,530.4)
(2007,591.38)
(2008,948.04)
(2009,596.01)
(2010,768.448)
(2011,978.0)
(2012,1050.0)};
\end{axis}
\end{tikzpicture}
\end{document}

ingrese la descripción de la imagen aquí

información relacionada