Let's say you want to draw a plot:
\documentclass[dvipsnames]{article}
\usepackage{pgfplots}
\usetikzlibrary{babel,calc,backgrounds,quotes,angles,patterns,decorations.markings,intersections,arrows,arrows.meta}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle,
axis line style = {-Latex[round],very thick},
% enlargelimits = true,
grid = both,
grid style={help lines},
xmin = -4,
ymin = -3.1,
xmax = 4,
ymax = 4,
xtick = {-3, ..., 3},
ytick = {-3, ..., 3},
xlabel style={below right},
ylabel style={above left},
x tick label style={below left},
samples = 100,
axis on top=true,
xlabel = {$x$},
ylabel = {$y$},
]
\coordinate (O) at (0, 0);
\addplot[very thick, color=Mahogany] {-x^2 + 2};
\end{axis}
\end{tikzpicture}
\end{document}
The result is:
How to make some fancy changes:
make x tick labels below right for negative x and below left for positive x;
show tick labels only for these points: (0, 0), (1, 0), (0, 1), (-1, 0), (0, -1)? If I change xtick = {-3, ..., 3} and ytick = {-3, ..., 3}, it will change the grid, but I want to keep it as it is for {-3, ..., 3) ticks.

