# Tikz Grid goes beyond graph

The Grid goes beyond the graph, as you can see in the screenshot below. What do i have to change, to make the grid align with the graph? It should only be inside the coordinate system.

\usepackage{tkz-euclide}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\usetikzlibrary{positioning}

\begin{figure}
\begin{center}
\begin{tikzpicture}
\tkzInit[ymax=6, xmin=-6, ymin=-1]
\tkzGrid[xmax=6, ymax=6]
%\tkzAxeXY
\begin{axis}[
xlabel=x,
ylabel={y}, % max(0, x)
legend pos=north west,
legend cell align=left
]
\end{axis}
\end{tikzpicture}
\caption{Relu und sigmoid function}
\end{center}
\end{figure}



• It seems like you are mixing two packages. pgfplots works on its own and also uses its own coordinates system, so it's better to use this package's options: - Remove the \tkzInit and \tkzGrid commands - To add a grid in the axis environment, just add the option grid. If you want to change the axis limits, you can add the options 'xmin=... in the axis environment. You can read the documentation for more details Aug 3 at 21:01

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=x,
ylabel=y,
legend pos=north west,
legend cell align=left,
grid,
ytick distance=1,
]
`