# tikz plot change one value of x axis

I'm not so familiar with tikz plot. The plot looks actually like it should, but I would like to change the last position value 300 to n in the plot. Is this possible ?

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{amssymb}
% for graphs
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{calc}
\def\layersep{2.5cm}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=No. of Neihbours,
ylabel=MAE
]
(1,     0.753804)
(10,    0.759822)
(25,    0.745213)
(50,    0.741495)
(75,    0.743365)
(100,   0.746219)
(175,   0.755337)
(200,   0.758157)
(300,   0.825300)
};

\legend{$fullcos$\\$d=3$\\$d=4$\\$d=5$\\$d=6$\\}

\end{axis}
\end{tikzpicture}
\end{document}

-
Hi superbly, please could you wrap your code into a minimal working example (MWE), starting with \documentclass. It makes it easier for me to reproduce your situation on my machine. – John Wickerson May 11 '13 at 20:13
You can use xticklabels={<list of values>}, as in \begin{axis}[ xlabel=No. of Neighbours, ylabel=RSME, xticklabels={0,0,50,100,150,200,250,n}, ] – Gonzalo Medina May 11 '13 at 20:32
I changed it to a full document. hope it helps. – superbly May 11 '13 at 20:33
Hi Gonzalo Medina. That was it. Thank you very much. If you make an answer, I will accept it. – superbly May 11 '13 at 20:35

One possibility would be to use xticklabels={<list of values>}:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
xlabel=No. of Neighbours,
ylabel=RSME,
xticklabels={0,0,50,100,150,200,250,n},
]
(1,     1.040923)
(10,    1.015503)
(25,    0.947140)
(50,    0.923818)
(75,    0.922332)
(100,   0.925733)
(175,   0.941590)
(200,   0.946928)
(300,   1.064557)
};
\legend{$d=2$\\$d=3$\\$d=4$\\$d=5$\\$d=6$\\}
\end{axis}
\end{tikzpicture}

\end{document}


If the list of x labels is too long, the above solution might be cumbersome; here's another approach, allowing to change only the last label, without modifying the previous values:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}

\begin{axis}[
xlabel=No. of Neighbours,
ylabel=RSME,
every x tick label/.append style={alias=ultick},
extra description/.append code={
\fill [white] (ultick.north west) ++(0pt,-2\pgflinewidth) rectangle (ultick.south east);
\node [anchor=south] at (ultick.south) {n};}        ]
(1,     1.040923)
(10,    1.015503)
(25,    0.947140)
(50,    0.923818)
(75,    0.922332)
(100,   0.925733)
(175,   0.941590)
(200,   0.946928)
(300,   1.064557)
};
\legend{$d=2$\\$d=3$\\$d=4$\\$d=5$\\$d=6$\\}
\end{axis}
\end{tikzpicture}

\end{document}


-