\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}

% GNUPLOT required
\begin{document}
\pagestyle{empty}


\begin{tikzpicture}[domain=0:4]
    \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
    \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
    \draw[color=red] plot[id=x] function{x}
        node[right] {$f(x) =x$};
    \draw[color=blue] plot[id=cos] function{cos(x)}
        node[right] {$f(x) = \cos x$};
    \draw[color=orange] plot[id=exp] function{0.05*exp(x)}
        node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}


\end{document}

%%latex -shell-escape myfile.tex

%%%& -shell-escape -enable-write18