Tracé propre des fonctions sinus et cosinus sur l'intervalle [-π, π] avec pgfplots. Axes au milieu, grille fine, légende, échantillonnage à 200 points pour un rendu fluide. Base réutilisable pour tout tracé de fonction : il suffit d'ajouter d'autres \addplot avec votre formule.
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmin=-3.5, xmax=3.5,
ymin=-2.5, ymax=2.5,
grid=both, grid style={line width=0.1pt, draw=gray!20},
xlabel={$x$}, ylabel={$y$},
width=10cm, height=7cm,
xtick={-3,-2,-1,1,2,3},
ytick={-2,-1,1,2},
samples=200
]
\addplot[blue, thick, domain=-3.14:3.14] {sin(deg(x))};
\addplot[red, thick, domain=-3.14:3.14] {cos(deg(x))};
\legend{$\sin x$, $\cos x$}
\end{axis}
\end{tikzpicture}
\end{document}