I am trying to make a line graph for annual observations. The X-axis is not displaying the years correctly; they come out as 2,008 / 2,009 etc.
Here is the code I used:
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel=Year,
ylabel=Number of certificates,
legend pos=north east,
legend entries={Eco,Private},
]
\addplot table [x=Year,y=Eco] {data.txt};
\addplot table [x=Year,y=Private] {data.txt};
\end{axis}
\end{tikzpicture}
\end{figure}
The table is in a separate file, data.tex, in the following format:
X Year Private Eco
1 2007 5877 nan
2 2008 921253 nan
3 2009 6131 nan
4 2010 6953 nan
5 2011 37184 nan
6 2012 61179 nan
7 2013 374902 18
8 2014 565200 12918
9 2015 137686 227964
10 2016 55295 204323
this is what the output looks like:
How can I get the values on the X axis to display as years?


[h!]usually latex will warn and change it (to[!ht]) but[htp]is almost always better. – David Carlisle Aug 03 '18 at 20:54