\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[xlabel=$x$, ylabel=$f(x)$, grid=major, width=8cm, height=6cm]
    \addplot[blue, thick, domain=-2:2] {x^2};
  \end{axis}
\end{tikzpicture}
\end{document}
