# Why it seems that the x-axis tick labels end much sooner than they should?

With the following code

\begin{tikzpicture}
\begin{axis}[ymin=50,ymax=150,colormap/blackwhite,
cycle list name=black white, xticklabels={2019-11,2019-12,2020-01,2020-02,2020-03,2020-05,2020-04,2020-06,2020-07,2020-08,2020-09,2020-10,2020-11,2020-12,2021-01,2021-02,2021-03,2021-04,2021-05,2021-06,2021-07,2021-08,2021-09,2021-10,2021-11,2021-12,2022-01,2022-02,2022-03,2022-04,2022-05,2022-06,2022-07,2022-08},smooth,xticklabel style={rotate=45,anchor=east}]
\end{axis}
\end{tikzpicture}


I produced the pic: The x-axis seems to stop at 2020 whereas, instead, there are other two years of data. How can I fix this problem?

EDIT of the post

Following a comment of the post I added xtick=data to the code but I obtained

• xtick=data perhaps? When you specify the ticklabels you should probably also specify the tick positions. Sep 21 at 5:51
• @TorbjørnT. thank you. I tried with your suggestion but I obtained the picture in the post (that I edited)
– Mark
Sep 21 at 6:34
• Clearly, they don't fit --- use a smaller font (xticklabel style={font=\tiny}? Not sure; check in the manual) and write less labels (xticklabels={2019-11, ,2020-01,, ...) Sep 21 at 7:27
• @Rmano, thank you, it works
– Mark
Sep 21 at 9:03

As noticed in comments by @TorbjørnT and myself, here is a possible solution, with the modifications:

1. this is a complete compilable document --- not so difficult, so please stick to that when asking;
2. Using xtick=data to force all the labels;
3. Clearly, they do not fit; so, for example, use a smaller font and plot every other point (done manually here);
4. Plot the labels nearer to the point by changing anchor and inner sep; otherwise is difficult to see to which tick the label is related.
\documentclass[margin=3mmm]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ymin=50,ymax=150,colormap/blackwhite,
cycle list name=black white,
xticklabels={2019-11,,2020-01,,2020-03,,2020-04,,2020-07,,2020-09,,2020-11,,2021-01,,2021-03,,2021-05,,2021-07,,2021-09,,2021-11,,2022-01,,2022-03,,2022-05,,2022-07,,},
xtick=data,
smooth,
xticklabel style={rotate=45,anchor=north east,font=\tiny, inner sep=1pt}]

[...]