Sarmate.net Sarmate.net
Accueil Fonctionnalités Offres Documentation Contact
Connexion Inscription
Retour à la galerie
TikZ EN

Exponential functions

Sarmate sarmate_examples 2026-05-03 0 15

Comparison of exponential and logarithm function graphs with annotated axes (pgfplots). Reference figure for calculus and pre-calculus courses. From Sarmate's technical TikZ gallery (sources: MartinThoma/LaTeX-examples MIT, TeXample.net LPPL) — see also our 900+ figures on /tikz-gallery.php.

Ouvrir dans la démo Connectez-vous pour aimer
\documentclass[12pt,border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{calc,angles,quotes,positioning,decorations.markings,arrows.meta,patterns,intersections,shapes,trees}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis x line=middle,
        axis y line=middle,
        grid = major,
        width=16cm,
        height=8cm,
        grid style={dashed, gray!30},
        xmin=-2.1,   % start the diagram at this x-coordinate
        xmax= 4.1,   % end   the diagram at this x-coordinate
        ymin= 0,     % start the diagram at this y-coordinate
        ymax= 17,    % end   the diagram at this y-coordinate
        xlabel=$x$,
        ylabel=$y$,
        ytick={0,2,3,4,8,9,12,16},
        yticklabels={0,2,3,4,8,9,12,16},
        legend cell align=left,
        legend pos=south east,
        legend style={draw=none},
        tick align=outside,
        enlargelimits=false]
      % plot the function
      \addplot[domain=-2:4, red, ultra thick,samples=500] {2^x};
      \addplot[domain=-2:4, green!50!black, ultra thick,dashed,samples=500] {3^x};
      \addplot[domain=-2:4, blue, ultra thick,dotted,samples=500] {4^x};
      \legend{$2^x$,$3^x$,$4^{x}$}
    \end{axis}
\end{tikzpicture}
\end{document}
Cet exemple est sous licence CC‑BY‑4.0. Vous pouvez le copier, le modifier et le redistribuer en citant l'auteur (Sarmate sarmate_examples).