Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up
Back to gallery
TikZ FR

Courbes sin et cos avec pgfplots

Sarmate sarmate_examples 2026-05-02 0 16

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.

Open in demo Sign in to like
\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}
This example is licensed under CC‑BY‑4.0. You may copy, modify, and redistribute it as long as you credit the author (Sarmate sarmate_examples).