How to remove the tick at x = 9 and y = 7 without removing the grid ?
\documentclass[border=5pt,tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\usetikzlibrary[arrows.meta,bending]
\usetikzlibrary{shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
restrict x to domain=0:9, xmax=9, xmin=0,
restrict y to domain=0:7, ymax=7, ymin=0,
x=1.5cm,
y=1.5cm,
axis x line = bottom,
axis y line = left,
axis line style =thick,
major tick style=black,
grid=both,
major grid style=lightgray,
minor grid style=lightgray,
minor tick num=1,
xticklabels={\empty,0,1,2,3,4,5,6,7,8},
yticklabels={\empty,\empty,1,2,3,4,5,6},
samples=5000,
>=stealth,
]
\addplot[smooth,thick] table {
0 0.5
0.5 1
1 2
1.5 2.875
2 3.625
2.25 4
2.5 4.375
3 5
3.5 5.4375
4 5.75
4.5 5.9375
5 6
5.1 6
5.25 6
5.5 6
6 6
7 6
8 6
};
\node[above right] at (axis cs:6.9,0.1) {Âge (en année)};
\node[above right] at (axis cs:0.1,6.5) {Masse (en kg)};
\draw[dashed,red] (axis cs:1,0)--(axis cs:1,2)--(axis cs:0,2);
\end{axis}
\end{tikzpicture}
\end{document}