# Different xtick distance for different x ranges

I created a graph using tikz, which ranges from -10 to 10 for the xaxis.

The graph has an xtick distance of 2, but I want to change the xtick distance so I get this: -10,-5,0,2...10. From -10 to 0, I want steps of 5, and from 0 to 10, I want steps of 2.

Is this possible to do?

I have added my code as well.

\begin{figure}[!htb]
\centering
\begin{tikzpicture}
\begin{axis}[xmin=-10, xmax = 10,ymin=0,
xtick distance=2,
xlabel=$x$,ylabel=$Error$,
title = {Output Error},
]
\end{axis}
\end{tikzpicture}
\end{figure} Welcome to TeX-SE! You can just punch in what you want to get: xtick={-10,-5,0,2,4,...,10}. Obviously I do not have your data file.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-10, xmax = 10,ymin=0,
xtick={-10,-5,0,2,4,...,10},
xlabel=$x$,ylabel=Error,
title = {Output Error},
] • @marmot I now see it in the OP code. In your screenshot I saw it first as it hurts the eye. :-) Well, no need to keep my vote, I can revert it but it (technically) requires an edit on your post as a vote is locked in after hours. Feel free to make a minor edit (such as a comment on use of $Error$) and I'm happy to revert my downvote when the lock-in is canceled that way. – Stefan Kottwitz Jul 8 at 9:24
• Btw. my explaining comment "-1 because I think one should not write $Error$ in math mode italics such as a product of variables." has been deleted (so now it's missing context a bit here). Again, I can revert the -1 vote as that mistake is not yours. As above. – Stefan Kottwitz Jul 8 at 9:39