% !TEX encoding = UTF-8
% !TeX program = pdflatex
% !TeX spellcheck = fr_FR
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz} % also loads pfg package
\usetikzlibrary{calc,decorations,arrows,patterns,shapes}
\begin{document}

\begin{tikzpicture}
\draw (0,0)--(0,1)--(1,1)--(1,0);
\end{tikzpicture}%
\quad%
\begin{tikzpicture}
\draw [color=red, fill=yellow, thick] 
    (0,0)--(0,1)--(1,1)--(1,0)--cycle;
\end{tikzpicture}
\end{filecontentsexe}

\bigskip

\begin{tikzpicture}[x=2cm, y=2cm]\footnotesize
\draw [color=red, fill=yellow, thick](0,0)-- (0,1) 
--(1,1)--(1,0)  node[below right,teal] {$a$} --cycle;
\node[ellipse,draw=blue] (A) at(0,0.5){$d=\sqrt{2a}$};
\end{tikzpicture}

\bigskip

\tikzset{  xmin/.store  in=\xmin,  xmin/.default=-3,  xmin=-3,
           xmax/.store  in=\xmax,  xmax/.default=3,  xmax=3,
           ymin/.store  in=\ymin,  ymin/.default=-3,  ymin=-3,
           ymax/.store  in=\ymax,  ymax/.default=3,  ymax=3 }

\begin{tikzpicture}[xmin=-2,xmax=2,ymin=-2.3,ymax=2.3,
	declare function={ff(\x)=\x-exp(-2*\x*\x);}]
\draw[help lines,xstep=1,ystep=1] 
 (\xmin,\ymin) grid (\xmax,\ymax);
\foreach  \x in {-2,...,2} \draw (\x,\ymin)--(\x,\ymin) 
   node[below] {\x};
\draw[very thick]  (\xmin,\ymin)  rectangle  (\xmax,\ymax);
\draw[thick,red] plot [domain=-2:2,smooth] (\x,{ff(\x)});
\draw[teal] plot [domain=\xmin:\xmax,samples=2] (\x,\x);
\end{tikzpicture}

\end{document}